Help using Base SAS procedures

retrieving output from procedures

Reply
Occasional Contributor
Posts: 14

retrieving output from procedures

Hi,

I would like to write SAS code so output from procedures is automatically put into a table. For example, if I run proc means data=data1 mean N NMISS on 15 variables, I would like the output to go into a table with four columns (variable name, mean, N, NMISS) and 15 rows (one for each variable). Is that possible? I can do this in Stata, because all output is stored in scalars and matrices, which can be accessed and put into a matrix (i.e., table) that I create.

Thanks,

Brent Fulton

UC Berkeley

Regular Contributor
Posts: 184

Re: retrieving output from procedures

Posted in reply to BrentFulton

See

http://www.sascommunity.org/wiki/PROC_MEANS_-_Improve_on_the_default

BrentFulton wrote:

Hi,

I would like to write SAS code so output from procedures is automatically put into a table. For example, if I run proc means data=data1 mean N NMISS on 15 variables, I would like the output to go into a table with four columns (variable name, mean, N, NMISS) and 15 rows (one for each variable). Is that possible? I can do this in Stata, because all output is stored in scalars and matrices, which can be accessed and put into a matrix (i.e., table) that I create.

Thanks,

Brent Fulton

UC Berkeley

Respected Advisor
Posts: 3,799

Re: retrieving output from procedures

Be aware that the last time I looked this program did not produce 2-sided confidence intervals as you would expect when both are Upper and Lower CI are requested.

Super User
Super User
Posts: 7,050

Re: retrieving output from procedures

Posted in reply to BrentFulton

Almost all procedure will now deliver the output into datasets for you using the ODS output system. 

http://support.sas.com/documentation/cdl/en/odsug/62755/HTML/default/viewer.htm

Also many procedures have options to specify output datasets.

In particular for PROC MEANS/SUMMARY there is the OUTPUT statement.

Valued Guide
Posts: 2,177

retrieving output from procedures

Tom

before SAS9.3, ODS OUTPUT wasn't generating the layout that seemed natural in the output window (and I'm not sure if it will now - in 9.3). So Myra Olstik started her project to automate the process of creating a column for each variable with a row for each requested statistic.The results of that project are described in a paper with the macro code, that can be found at the link offered above, by Howles http://www.sascommunity.org/wiki/PROC_MEANS_-_Improve_on_the_default

As you suggest, the solution uses the output statement (one for each statistic).

peterC

Ask a Question
Discussion stats
  • 4 replies
  • 124 views
  • 0 likes
  • 5 in conversation