In my dataset, I want to create three subsets of variables with the suffix [x] [y] [z].
If these were prefix, I knew how to do it in a data set and using (keep=prefix:). Is there an easy way for suffix?
Thanks
Not as easy as the : operator for the prefix.
However, it can be done. A Google search will probably give you a few ways quickly.
Hello,
Unfortunately there's no easy way with a wildcard.
You can do this (to be adapted and applied to your situation):
proc sql noprint;
select distinct name into: names separated by ' '
from dictionary.columns
where libname='SASHELP'
and memname='CLASS'
and upcase(name) like '%HT';
quit;
%PUT &=names;
data want;
set sashelp.class(drop=&names);
run;
/* end of program */
Cheers,
Koen
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.