Let’s say that we have a number of SAS data files in a directory and we need to know the number of observations and the number of variables in each data set. Of course, we can always use proc contents on each of the data set, but it can get tedious and the output will get too long really quickly.
There is an easy solution by using the SAS data file sashelp.vtable that SAS creates and updates during an active SAS session.
Here is an example. Let’s say we have a directory called c:datadissertation and it contains many SAS files. Here is the sas code to display all the SAS files in the directory with information on the number of observations and the number of variables.
libname dis 'c:datadissertation'; proc print data = sashelp.vtable (where = (libname="DIS")) noobs; var memname nobs nvar; run;memname nobs nvar MEDICATION_PP 1242 11 META20 20 10 METARESP 105 14 MISFLAT 831 7 MONKEYS 123 7 MULTRESP 134 12 NHIS_SMALL 30663 7 OPPOSITES_PP 140 6 PEETCOMP 187 9 PEETMIS 269 9 ......