11-25-2015 06:40 AM
proc sql noprint; select NVAR into NUM_VARS from DICTIONARY.TABLES where LIBNAME="SASHELP" and MEMNAME="CLASS"; quit; %put Number of variables = &NUM_VARS.;
Its all in the metadata tables -> SASHELP.VTABLE, VCOLUMN or respectively for SQL DICTIONARY.TABLES, COLUMNS.
11-26-2015 04:07 AM
11-26-2015 04:43 AM
Please look at the code I have posted in the previous mail, and compare it to what you have posted here. You will see that you are select dataset name (variable MEMNAME), not the count of variables variable (which is NVAR).
In fact, examine the tables presented in the SASHELP library, VTABLE and VCOLUMN, you will then see the metadata of all the tables in SAS.
11-30-2015 06:53 AM
NUM_VARS is a macro variable. Macro Variables are always text. To use is as a number you need to wrap it in an input, e.g