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.

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!

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.

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!
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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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