04-30-2014 07:37 PM
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.
04-30-2014 07:40 PM
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.
04-30-2014 08:01 PM
Proc datasets library=yourlibrarynamehere memtype=data details;
contents data=_all_ details order=varnum;
Will get you 1 and 2. Options exist to create output datasets with the information.