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.
Enroll for instructor led training free demo
Course Categories
SAS Tutorial For Beginners
- adtest
- test
- SAS Programming Global Options
- SAS Programming Fundamentals
- SAS Numeric Formats
- SAS Date Formats
- SAS Programming Macros
- SAS Programming SQL
- What are the different options in transpose?
- SAS Programming Graphs
- What are the different options in proc tabulet?
- What are the different options in proc report?
- What are the different options in proc freq?
- What are the different options in proc means?
- What are the different arrays in SAS?
- What are the different loops in SAS?
- What are the different options in conditional statements?
- What are the different options in merge?
- SAS Programming proc print & proc sort options?
- SAS Programming Functions
- SAS Programming proc import & Proc Export options?
- SAS Programming Data Set Options in SAS?
- SAS Programming proc format?
- SAS Programming Infile options
- SAS Programming input methods
- What are the Proc Contents in SAS?
- How to create SAS Libiray?
- How to create simple Program in SAS?
- SAS Software windows
- SAS Introduction