BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
cbrotz
Pyrite | Level 9

I am using the following code to see the members in a library called "sasdata".  It is creating a report file.  Is there an option in proc datasets to output a data file instead?

 

options pagesize=60 linesize=80 nonumber nodate;

proc datasets library=sasdata;

 

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisHemedinger
Community Manager

Output to Excel is one way to do it -- good job figuring that out.

 

ODS generates SAS tables for all of the output steps, and you can redirect these to SAS data sets for further manipulation.  See this tip from @Ron_Cody for more information.

 

Here's an example for you:

 

/* discover the ODS tables that we can grab */
ods trace on;

/* Save member attributes */
ods output datasets.members=Members; 
/* Save variable attributes for select data sets */
ods output Datasets.DataSet.Variables = Variables;

proc datasets lib=sashelp;
 contents data=cars;
 contents data=class;
 contents data=air;
quit;

Then you can use PROC SQL, SORT, or any other procedure to report on what you want.

Learn from the Experts! Check out the huge catalog of free sessions in the Ask the Expert webinar series.

View solution in original post

5 REPLIES 5
Haikuo
Onyx | Level 15
Please do RTM. Pay extra attention to statement 'contents' and 'out=/out2=' options.
http://support.sas.com/documentation/cdl/en/proc/65145/HTML/default/viewer.htm#p1v2467vdjbp7xn1222c7...
cbrotz
Pyrite | Level 9

I just want to manipulate the list of dataset names in the library by file size, etc.  The Contents gives the detail fields of the individual datasets.  I  ended up just changing the output to Excel from Report and sorted the data in Excel.  If there was another way to do this, it was not clear from what I read.

ChrisHemedinger
Community Manager

Output to Excel is one way to do it -- good job figuring that out.

 

ODS generates SAS tables for all of the output steps, and you can redirect these to SAS data sets for further manipulation.  See this tip from @Ron_Cody for more information.

 

Here's an example for you:

 

/* discover the ODS tables that we can grab */
ods trace on;

/* Save member attributes */
ods output datasets.members=Members; 
/* Save variable attributes for select data sets */
ods output Datasets.DataSet.Variables = Variables;

proc datasets lib=sashelp;
 contents data=cars;
 contents data=class;
 contents data=air;
quit;

Then you can use PROC SQL, SORT, or any other procedure to report on what you want.

Learn from the Experts! Check out the huge catalog of free sessions in the Ask the Expert webinar series.
Reeza
Super User

It's already in a data set in the SASHELP library.

VTABLE has table level information - number of variables, observations, size, type etc

VCOLUMN has variable level information - variable types, name, lengths, formats, etc.

 

data demo;
set sashelp.vcolumn (obs=3);
run;

@cbrotz wrote:

I just want to manipulate the list of dataset names in the library by file size, etc.  The Contents gives the detail fields of the individual datasets.  I  ended up just changing the output to Excel from Report and sorted the data in Excel.  If there was another way to do this, it was not clear from what I read.


 

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
  • 5 replies
  • 9905 views
  • 6 likes
  • 5 in conversation