Excludes variables from output SAS data sets.
| Valid in: | DATA step |
|---|---|
| Categories: | CAS |
| Information | |
| Type: | Declarative |
Table of Contents
specifies the names of the variables to omit from the output data set.
| Tip | You can list the variables in any form that SAS allows. |
|---|
The DROP statement applies to all the SAS data sets that are created within the same DATA step and can appear anywhere in the step. The variables in the DROP statement are available for processing in the DATA step. If no DROP or KEEP statement appears, all data sets that are created in the DATA step contain all variables. Do not use both DROP and KEEP statements within the same DATA step.
If the same variable is listed on both the DROP and KEEP statements, DROP takes precedence over KEEP regardless of the order of the statements, and the variable is dropped.
These examples show the correct syntax for listing variables with the DROP statement.
drop time shift batchnum;
drop grade1-grade20;
In this example, the variables PURCHASE and REPAIR are used in processing but are not written to the output data set INVENTRY.
data inventry;
drop purchase repair;
infile file-specification;
input unit part purchase repair;
totcost=sum(purchase,repair);
run;