• No products in the cart.

SAS Programming Data Set Options in SAS?

Play Video

In SAS, data set options are used to modify the behavior of the DATA step when reading, writing, or updating SAS data sets. Some of the commonly used data set options are:

1. OBS: limits the number of observations to be processed by the DATA step.
2. FIRSTOBS: specifies the first observation to be processed by the DATA step.
3. DROP: specifies variables to be excluded from the output data set.
4. KEEP: specifies variables to be included in the output data set.
5. RENAME: renames variables in the output data set.
6. WHERE: selects a subset of observations to be processed by the DATA step.
7. IN: specifies an input data set to be read by the DATA step.
8. OUT: specifies the name of the output data set to be created.
9. REPLACE: specifies that an existing output data set should be replaced.
10. UPDATE: specifies that an existing output data set should be updated.
11. INDEX: creates an index for the output data set.
12. COMPRESS: compresses the output data set to save storage space.

These options can be used to customize the behavior of the DATA step and to control the output data set. For example, the following code reads an input data set called MYDATA, selects a subset of observations based on a WHERE condition, and writes the selected observations to an output data set called NEWDATA:

data newdata (drop=var1 var2);

   set mydata (keep=var1 var2 var3)

   where var1=’A’;

   rename var3=newvar;

run;

This code drops variables var1 and var2 from the output data set, keeps variables var1, var2, and var3 from the input data set, renames var3 to newvar, selects only the observations where var1=’A’, and writes the output data set to NEWDATA.

16/03/2023
Template Design © Bodhan soft technologies PVT.LTD. All rights reserved. <meta name="facebook-domain-verification" content="cg6nsg7wc0h385jtk0v0gswpb924ti" />

Connect with :




Chat with Us
1
We are Online
Hello ,
How we can help you ?