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;

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

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
  • 1422 views
  • 4 likes
  • 4 in conversation