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

I am using the following code to create a dataset of the file names for all SAS datasets within a specified folder (I then trim part of the filename in the second step).  I want to add a second field, one that includes the number of observations in each of the named datasets.  Thoughts?  Thanks in advance.

 

proc sql;
CREATE TABLE CULL AS
select catx('.',libname,memname) into :setnames separated by ' '
from dictionary.tables
where libname = 'RESULTS';
quit;

DATA Cull ;
SET CULL;
_TEMA001=tranwrd(_TEMA001,"RESULTS.TARGETS_","");
RUN;
1 ACCEPTED SOLUTION

Accepted Solutions
hhinohar
Quartz | Level 8
proc sql;
CREATE TABLE CULL AS
select catx('.',libname,memname) ,nobs into :setnames,:nobs separated by ' '
from dictionary.tables
where libname = 'RESULTS';
quit;

Like this?

https://documentation.sas.com/?cdcId=vdmmlcdc&cdcVersion=1.0&docsetId=mcrolref&docsetTarget=n1y2jszl...

View solution in original post

1 REPLY 1
hhinohar
Quartz | Level 8
proc sql;
CREATE TABLE CULL AS
select catx('.',libname,memname) ,nobs into :setnames,:nobs separated by ' '
from dictionary.tables
where libname = 'RESULTS';
quit;

Like this?

https://documentation.sas.com/?cdcId=vdmmlcdc&cdcVersion=1.0&docsetId=mcrolref&docsetTarget=n1y2jszl...

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
  • 1 reply
  • 962 views
  • 0 likes
  • 2 in conversation