Works perfectly, thanks for your help!
I would also suggest using DICTIONARY.COLUMNS in stead of SASHELP.VCOLUMN in Proc SQL. I notice very different performance, seconds versus minutes, with the number of libraries, datasets and variables involved on my system.
Since the OP says that his datasets have "hundreds of variables" this performance might be noticeable.
I also have the experience that @Reeza commented on. With time, SAS seems to have gotten much better at handing over where conditions through the SASHELP.Vxxxxxx views.
In earlier times, I would have the same problems with very bad performance of SASHELP:VTABLE or SASHELP.VCOLUMNS, but now (9.4 M5) there's no noticeable difference.
Hello,
%macro freq_means(lib, mem, var);
data _NULL_;
set &lib..&mem.;
if vtype(&var.)="C" then call execute('proc freq data=&lib..&mem.; table &var.; run;');
else call execute('proc means data=&lib..&mem.; var &var.; run;');
stop;
run;
%mend;
%freq_means(sashelp, class, NAME);
%freq_means(sashelp, class, age);
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.