DATA Step, Macro, Functions and more

ODS Table Output for PROC Means

Accepted Solution Solved
Reply
Contributor
Posts: 59
Accepted Solution

ODS Table Output for PROC Means

I wish to use ODS Table Name Output within Proc Means to construct an output data set that contains

( For Example ) the following columns:

 

Variable_Name,    Var_Min,           Var_Median,            Var_Max,                Var_Mean 

Var_01                  Var_01_Min      Var_01_Median       Var_01_Max           Var_01_Mean

Var_02                  Var_02_Min      Var_02_Median       Var_02_Max           Var_02_Mean

 

Var_60                  Var_60_Min      Var_60_Median       Var_60_Max           Var_60_Mean

 

Ultimately I wish to merge several such SAS Data Sets generated by Proc Means to construct the following Data Set:

 

Variable_Name   Y_Variable, Var_X1_Median, Var_X2_Median,   Var_X3_Median

 

                            where the Y-Variable may be dependent on one or more of the X variables

 

I constructed the base data set as follows: 

 

PROC FREQ
     DATA = WORK.DATA2SS NLEVELS ; 
    TABLES SQ01 - SQ59 / NOCOL ;
    ODS OUTPUT NLEVELS = WORK.QUESTLEVELS_1 ;

RUN;

 

So my Data set should contain:

 

SQ01      Y01=NLEVELS01  X101  X201  X301

SQ02      Y02=NLEVELS02  X102  X202  X302

 

SQ59      Y59=NLEVELS59  X159  X259  X359


Accepted Solutions
Solution
‎05-15-2016 03:41 PM
Super User
Posts: 19,815

Re: ODS Table Output for PROC Means

Posted in reply to JonDickens1607

RTM.

http://support.sas.com/documentation/cdl/en/proc/65145/HTML/default/viewer.htm#p17h6q7ygvkl1sn13qzf9...

 

Use STACKODS option and ODS OUTPUT. 

 

proc means data=sashelp.class stackods;
ods output summary=want;
run;

proc print data=want;
run;

View solution in original post


All Replies
Solution
‎05-15-2016 03:41 PM
Super User
Posts: 19,815

Re: ODS Table Output for PROC Means

Posted in reply to JonDickens1607

RTM.

http://support.sas.com/documentation/cdl/en/proc/65145/HTML/default/viewer.htm#p17h6q7ygvkl1sn13qzf9...

 

Use STACKODS option and ODS OUTPUT. 

 

proc means data=sashelp.class stackods;
ods output summary=want;
run;

proc print data=want;
run;
Contributor
Posts: 59

Re: ODS Table Output for PROC Means

OK, thanks for that, I will give it a try and see if it solves my problem

##- Please type your reply above this line. Simple formatting, no
attachments. -##
SAS Super FREQ
Posts: 3,753

Re: ODS Table Output for PROC Means

Posted in reply to JonDickens1607

In addition to PROC MEANS, you might want to look at the OUTTABLE= option in PROC UNIVARIATE. See the article

"Save descriptive statistics for multiple variables in a SAS data set"

Contributor
Posts: 59

Re: ODS Table Output for PROC Means

Thanks Rick.

The DO LOOP is my first port of call.

You are right, no matter how long one has been using SAS, when solving a
new problem there is always the opportunity to learn something new and
where possible to share this knowledge with others.

##- Please type your reply above this line. Simple formatting, no
attachments. -##
SAS Super FREQ
Posts: 3,753

Re: ODS Table Output for PROC Means

Posted in reply to JonDickens1607

What a positive philosophy! Thanks for the inspiring thought.

Contributor
Posts: 59

Re: ODS Table Output for PROC Means

Initially, it was interesting mathematically because of the matrix based
analysis in IML but difficult to apply as I did not have access to IML at
work.

However, now that I have started using SAS University Edition at home, I
can experiment with IML and will probably revisit many of the DO LOOP
Articles in order to work through.

I have made good use of those articles on Scatterplots and Predictive /
Confidence Ellipses in EDA.

##- Please type your reply above this line. Simple formatting, no
attachments. -##
SAS Super FREQ
Posts: 3,753

Re: ODS Table Output for PROC Means

Posted in reply to JonDickens1607

Thanks for reading. There are many articles on The DO Loop that do not involve matrix computations. In addition to serving SAS/IML programmers, I try to create content that appeals to Base SAS programmers, SAS/STAT analysts, and analysts who create statistical graphics.

Contributor
Posts: 59

Re: ODS Table Output for PROC Means

Yes, I have found your DO LOOP articles generally very useful.

BTW I have purchased both your books. ( IML and Simulation )

Very few of my Financial Service Clients have ever licensed IML.

Perhaps SAS should include IML within the SAS "Analytics" Product Bundle
which most banks seem happy to license.

Especially given the migration to R which is vector / matrix based.

Cheers

##- Please type your reply above this line. Simple formatting, no
attachments. -##
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 8 replies
  • 703 views
  • 2 likes
  • 3 in conversation