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 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

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