Hi All,
I need to find all the datasets with zero observation in a library. How should I do that? Any suggestion is highly appreciated.
Thanks - Linlin
Linlin,
Could you use dictionary.tables to find your info? there is a variable 'nobs' delivering what you need.
Haikuo
Linlin,
Could you use dictionary.tables to find your info? there is a variable 'nobs' delivering what you need.
Haikuo
Hi Haikuo,
Thank you very much! - Linlin
My code:
proc sql;
create table want as
select memname,nobs
from dictionary.tables
where libname='WORK' and memname like "_%" and nobs=0;
quit;
proc print data=want;
run;
Recommend you use nlobs to instead fo nobs.
When Some data set be modified directly ,not random modified, NOBS will return not exactly the nobs.
Good point. Thank you Ksharp! - Linlin
proc sql noprint;
create table temp/* if you want it use in a dataset*/ as select libname as library_name,
memname as Name
from sashelp.Vtable where Libname="Work" /* you can use any library*/
and nobs=0;
select count(*)
into:Nobs
from temp;
Select Name
into :Name1-:Name%left(&Nobs)
from temp;
quit;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.