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.


SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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