Sample Topic 4: Keeping, Dropping and Renaming Variables

h

The DROP Data Set Option

The DROP data set option is very similar to the KEEP data set option.

Instead of keeping the variables in the data set, the DROP option drops the variables from the data set.

Example

Data Class;
Set SASHelp.class (drop=name age sex);
Run;

The DROP data set option drops the NAME, AGE and SEX variables from the input SASHelp.class data set.

Only the HEIGHT and WEIGHT variables are left in the output:

✍️ Exam Tips

The KEEP and DROP options can be used within a single data step.

? Sample Exam Question(s):

Question 2

Get Solution