SAS Dictionary Table Gallery with over 4 SAS Examples

See SAS Dictionary Table and Proc SQL.

______________________________________________

1. Model syntax for list of available libnames, tables, nvar and nobs

PROC SQL; SELECT UNIQUE libname, memname, nvar, nobs FROM DICTIONARY.tables where upcase(libname) in ('LEXLIB'); QUIT;


2. Model syntax for list of column attributes for table

PROC SQL; SELECT UNIQUE libname, memname, name, type, length, label, format FROM DICTIONARY.columns where upcase(libname) in ('LEXLIB') and upcase(memname) in ('_SKELETON_'); quit;


3. Model syntax to transfer list of variable names from dictionary table to display number of missing values

proc sql;
SELECT 'nmiss(' || compress(name) || ') as ' || compress(name) || '_Missing' into :mislst separated by ',' FROM DICTIONARY.columns
where upcase(libname) in ('LEXLIB') and upcase(memname) in ('_SKELETON_');

SELECT count(*) as TotalRecords, &mislst from lexlib._skeleton_;
quit;
 

4. Model syntax for SAS Procedures - Number of numeric, character and date variables in a data set

proc tabulate data=sashelp.vcolumn format=4.0;
class libname memname type;
table libname*memname all, type all / rts=45 misstext="0";
where upcase(libname) in ('LEXLIB');
run;

Powered by Wild Apricot Membership Software