Dear All,
Can some one help me in writing number of dataset in a library into a macro variable.
For example:
If a library x has 50 datasets. I should get the value of 50 in macro variable.
Thanks
Rakesh
Replace LIBRARY with the name of the library you want to use. The library names are kept in all capital letters in the table.
proc sql; select count(memname) into : dscount from dictionary.members where libname='LIBRARY' and memtype='DATA'; quit; %put &dscount;
Try this:
proc sql noprint;
select count(memname) into :number
from sashelp.vmember
where libname='CCARLIB' and memtype='DATA';
quit;
This example sets the macrovariable &number with the number of datasets in the CCARLIB library.
Regards,
Replace LIBRARY with the name of the library you want to use. The library names are kept in all capital letters in the table.
proc sql; select count(memname) into : dscount from dictionary.members where libname='LIBRARY' and memtype='DATA'; quit; %put &dscount;
for more information use this code
PROC sql noprint;
create table list_memnames as
select libname,
monotonic() as memnum label='member number',
memname, nobs, nvar as nvars, memlabel
from dictionary.tables
where libname eq "%upcase(&libname)"
and memtype eq 'DATA';
quit;
Ron Fehd
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.