Reading and Concatenating SAS Data Sets |
Selecting Variables |
When you create a new data set, you can use options to drop
or keep variables that are stored in the original data set. You name the
variables that you want to drop or keep using the DROP= and KEEP=
data set options.
You can use the KEEP= option instead of the DROP= option if more variables are dropped than kept. You specify data set options in parentheses after a SAS data set name. |
General form, DROP= and KEEP= data set
options:
where
|
Because you are only interested in treadmill time and tolerance
levels, for example, you may want to drop the variables ID ,
Name , RestHR , MaxHR , and
RecHR and keep the variables
TimeMin , TimeSec , and
Tolerance when you
create the TestTime data set. |
data work.testtime(keep=timemin timesec tolerance); set clinic.stress2(drop=id name |
ID | Name | RestHR | MaxHR | RecHR | TimeMin | TimeSec | Tolerance |
2458 | Murray, W | 72 | 185 | 182 | 12 | 38 | D |
2462 | Almers, C | 68 | 171 | 133 | 10 | 5 | I |
2501 | Bonaventure, T | 78 | 177 | 139 | 11 | 13 | I |
2523 | Johnson, R | 69 | 162 | 114 | 9 | 42 | S |