BookmarkSubscribeRSS Feed
Nikos
Fluorite | Level 6

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

2 REPLIES 2
Reeza
Super User

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.

ballardw
Super User

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.


hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1240 views
  • 0 likes
  • 3 in conversation