BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
MarcTC
Obsidian | Level 7
proc contents data=a._all_ out=a1 memtype=data noprint;
run;

a1 has all datasets info down to variable level. I know I can use another proc sql(see code below) to get the list of dataset names. But I still want to know how to do it in proc contents or any other procedures if this is possible.


proc sql;
select distinct memname
from a1
; quit;
1 ACCEPTED SOLUTION

Accepted Solutions
data_null__
Jade | Level 19
Try this...

[pre]
ods output Members=Members;
proc datasets library=work memtype=data;
run;
quit;
[/pre]

View solution in original post

6 REPLIES 6
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
PROC DATASETS provides a list. Also, consider reviewing the PROC CONTENTS option NODS, when using the DATA=._ALL_ parameter.

Scott Barry
SBBWorks, Inc.

Suggested Google advanced search argument, this topic / post:

proc contents member list site:sas.com
MarcTC
Obsidian | Level 7
I did use NODS option, but it returns a1 with 0 observation.

proc contents data=viewstr._all_ out=a1 memtype=data nods;
run;
data_null__
Jade | Level 19
Try this...

[pre]
ods output Members=Members;
proc datasets library=work memtype=data;
run;
quit;
[/pre]
MarcTC
Obsidian | Level 7
I want to output the list to a dataset for later manipulation. There is no out option in proc datasets.
Cynthia_sas
SAS Super FREQ
But, ODS OUTPUT will create an output dataset from the output object MEMBERS. If you use ODS TRACE ON/ODS TRACE OFF around PROC DATASETS, you will see the following output:
[pre]
893 ods trace on;
894 proc datasets library=work memtype=data;

Output Added:
-------------
Name: Directory
Label: Directory Information
Template: Base.Datasets.Directory
Path: Datasets.Directory
-------------
Directory

Libref WORK
Engine V9
Physical Name C:\DOCUME~1\Temp\SAS Temporary Files\_TD5040
Filename C:\DOCUME~1\Temp\SAS Temporary Files\_TD5040

Output Added:
-------------
Name: Members
Label: Library Members
Template: Base.Datasets.Members
Path: Datasets.Members
-------------

Member File
# Name Type Size Last Modified

1 MEMBERS DATA 5120 22Nov10:15:50:19
2 PRDSALE DATA 50176 22Nov10:10:57:31
3 REPORT_DATA DATA 209920 22Nov10:08:45:15
895 run;

896 quit;

NOTE: PROCEDURE DATASETS used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds

897 ods trace off;
[/pre]

The "Output Added" means that the procedure created an "output object" and it is this ODS output object that gets routed to ODS destinations. Not all ODS destinations are report destinations like LISTING, RTF and PDF and HTML. ODS DOCUMENT and ODS OUTPUT are destinations that are NOT report destinations. ODS OUTPUT is the destination that creates output datasets.

That means that you can write the output object "MEMBERS" to a dataset with the ODS OUTPUT statement, as shown in data _null_'s code. One of the great features of the Output Delivery System is the fact that if a procedure creates an output object you can make a dataset from that output object -- EVEN IF the dataset itself does not support or have an OUT= option or OUTPUT statement.

Check it out. There are a lot of good papers and examples out there on the use of ODS OUTPUT.

cynthia
data_null__
Jade | Level 19
Yes, that is why I used ODS OUTPUT to create data set MEMBERS.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 123394 views
  • 7 likes
  • 4 in conversation