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.

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.

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

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 5 replies
  • 8174 views
  • 6 likes
  • 5 in conversation