Help using Base SAS procedures

how drop var with a part of char in the name ?

Reply
New Contributor
Posts: 2

how drop var with a part of char in the name ?

I would drop every var that has a specific char in the name without write each var:

for example if var are (abc_01 abc_02 abc_03 hh_01 hh_02) I'd like to drop hh_01 and hh_02

is it possible ?

Super User
Posts: 19,772

Re: how drop var with a part of char in the name ?

If you want to drop any var that starts with hh use the colon notation.

Drop hh: ;

New Contributor
Posts: 2

Re: how drop var with a part of char in the name ?

Thank you !!

If I want to drop any var that end with _01 what I have to use instead ":" ?

Super Contributor
Posts: 308

Re: how drop var with a part of char in the name ?

Hello,

proc sql noprint;
select name into :vars separated by ' ' from sashelp.vcolumn
where memname='CLASS' and libname='SASHELP' AND name like '%e';
quit;

%put &vars;

data want;
set sashelp.class (drop=&vars) ;
run;

Ask a Question
Discussion stats
  • 3 replies
  • 173 views
  • 0 likes
  • 3 in conversation