optimization - SAS drop multiple variables indexed by tens -
my question stupid have not found answer yet. have variable var index tens : var10, var20... var90. @ point of code want drop of them.
i can
data want(drop=var10 var20 var30 var40 var50 var60 var70 var80 var90); set have; run;
i wondering if there more condensed way of doing that. know if there variables indexed 10, 11, 12, 13... use
(drop=var10-90)
but not have them, if use instruction still job, warning, not acceptable me (i have create programs used people little nothing programming knowledge, report warning one).
thanks in advance
if var<xx>
variables multiples of ten, i.e. there no other variables beginning var
, can use colon-operator, acts wildcard, e.g.
drop var: ; /* drop variables beginning 'var' */
alternatively, can dynamically generate list of variables :
proc sql noprint ; select name :varlist separated ' ' dictionary.columns libname = 'work' , memname = 'have' , compress(name,,'ka') = 'var' , mod(input(compress(name,,'kd'),8.),10) = 0 /* convert var<xx> xx , check divisible 10 */ order name ; quit ; data want (drop=&varlist) ; set have ; run ;
Comments
Post a Comment