BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Linlin
Lapis Lazuli | Level 10

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

1 ACCEPTED SOLUTION

Accepted Solutions
Haikuo
Onyx | Level 15

Linlin,

Could you use dictionary.tables to find your info? there is a variable 'nobs' delivering what you need.

Haikuo

View solution in original post

5 REPLIES 5
Haikuo
Onyx | Level 15

Linlin,

Could you use dictionary.tables to find your info? there is a variable 'nobs' delivering what you need.

Haikuo

Linlin
Lapis Lazuli | Level 10

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;

Ksharp
Super User

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.

smonodeep
Calcite | Level 5

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;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 2189 views
  • 4 likes
  • 4 in conversation