Help using Base SAS procedures

Explore & Summarize info about a Library Members(datasets) and their variables when both Datasets and Variables are unknown

Reply
Contributor
Posts: 68

Explore & Summarize info about a Library Members(datasets) and their variables when both Datasets and Variables are unknown

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

Super User
Posts: 17,818

Re: Explore & Summarize info about a Library Members(datasets) and their variables when both Datasets and Variables are unknown

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.

Super User
Posts: 10,497

Re: Explore & Summarize info about a Library Members(datasets) and their variables when both Datasets and Variables are unknown

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.


Ask a Question
Discussion stats
  • 2 replies
  • 167 views
  • 0 likes
  • 3 in conversation