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
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.