Dear all,
I have a Library with unknown number of data sets and variables.
I would be grateful if you could provide me with, say a MACRO that loops through the LIBRARY and create summary tables with the following info.
1.--- Number of Datasets that reside in the Liibrary, their Names and the number of observations for each one of them
2.-- Number of variables, names and labels , type (char or numeric), length for EACH Variable within the various Datasets
3.-- For Character variables the different levels/categories (i.e. SEX -- Male, Female) including Missing and their respective Frequencies
4.-- For Numeric Values info similar to that generated by a PROC UNIVARIATE (i.e. Mean, Median, Std, Outliers etc.)
Thank you in advance.
Best regards
Nikos
1&2 can be solved by querying the sashelp.vtable and sashelp.vcolumn tables.
Based on that you can easily do 3/4, by using the _numeric_ and _character_ shortcuts in proc freq and proc means.
Proc datasets library=yourlibrarynamehere memtype=data details;
contents data=_all_ details order=varnum;
run;
quit;
Will get you 1 and 2. Options exist to create output datasets with the information.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.