Wednesday, October 18, 2006

Another Shortcut for Listing Variables

You can keep all of the numeric or character columns when creating a new data set without listing each one in your KEEP statement:
data test1 (keep = _numeric_); run;
data test2 (keep = _character_); run;

The work.source data set has three character and five numeric variables. This keep statement keeps one character variable (district) and all of the numeric variables:

data work.mix(keep= distname _numeric_);
set work.source;

This method can also be applied to drop, sum, arrays, etc.


Post a Comment

<< Home