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.
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.
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.
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.
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.
And for 9.4, there is the new documentation website: https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.3&docsetId=proc&docsetTarget=p1sy9ca...
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: