BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
JonDickens1607
Obsidian | Level 7

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

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

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

8 REPLIES 8
Reeza
Super User

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;
JonDickens1607
Obsidian | Level 7
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. -##
Rick_SAS
SAS Super FREQ

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"

JonDickens1607
Obsidian | Level 7
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. -##
Rick_SAS
SAS Super FREQ

What a positive philosophy! Thanks for the inspiring thought.

JonDickens1607
Obsidian | Level 7
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. -##
Rick_SAS
SAS Super FREQ

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.

JonDickens1607
Obsidian | Level 7
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. -##

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 8 replies
  • 22391 views
  • 4 likes
  • 3 in conversation