Since you are going for a "best practice", I would use the approach suggested by . The following uses that approach, combined with your latest code: data to_drop; informat _name_ $32.; input _name_; cards; _type_ name age height ; proc sql; create table to_drop2 as select distinct a._name_ from to_drop as a inner join dictionary.columns as b on upcase(a._name_) = upcase(b.name) where b.libname='SASHELP' and b.memname = 'CLASS' ; quit; data _null_; set to_drop2 end=last; if _n_=1 then call execute('data want; set sashelp.class (drop='); call execute(' '||strip(_name_)); if last then call execute('); run;'); run;
... View more