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

 

Hi all,

I'm looking to create some summary statistic as seen below

 

Is it possible to combine the results of 2 proc means? Using the data below, I want to calculate proc means with 2 different classes. Like so:


proc means data= have n min max median mean stddev maxdec=1 ;
class con parameter_n parameter ;
var score;
output out=overall;
run;

 

proc means data= have n min max median mean stddev maxdec=1 ;
class con parameter_n parameter site ;
var score;
output out=bysite;
run;

 

MEMBER SITE PARAMETER PARAMETER_N SCORE CON
1 A OSUT 1 12 ARI
1 A OCDT 2 12 ARI
2 A OSUT 1 32 ARI
2 A OCDT 2 37 ARI
3 A OSUT 1 31 ARI
3 A OCDT 2 24 ARI
4 A OSUT 1 34 ARI
4 A OCDT 2 24 ARI
5 A OSUT 1 37 ARI
5 A OCDT 2 20 ARI
22 A OSUT 1 21 ASI
22 A OCDT 2 48 ASI
25 A OSUT 1 21 ASI
25 A OCDT 2 41 ASI
26 A OSUT 1 23 ASI
26 A OCDT 2 42 ASI
27 A OSUT 1 32 ASI
27 A OCDT 2 52 ASI
28 A OSUT 1 30 ASI
28 A OCDT 2 44 ASI
9 B OSUT 1 39 ARI
9 B OCDT 2 25 ARI
10 B OSUT 1 29 ARI
10 B OCDT 2 27 ARI
11 B OSUT 1 29 ARI
11 B OCDT 2 23 ARI
15 B OSUT 1 33 ARI
15 B OCDT 2 29 ARI
16 B OSUT 1 27 ARI
16 B OCDT 2 36 ARI
17 B OSUT 1 29 ASI
17 B OCDT 2 32 ASI
20 B OSUT 1 13 ASI
20 B OCDT 2 36 ASI
21 B OSUT 1 39 ASI
21 B OCDT 2 34 ASI
22 B OSUT 1 6 ASI
22 B OCDT 2 32 ASI
23 B OSUT 1 18 ASI
23 B OCDT 2 33 ASI

 

My results should like like this:

 

Parameter     Site         Statistics         ARI                ASI           Diff ASI - ARI

OSUT         Overall            n                  xx                  xx                 -xx

                                    mean (SD)      xx.x(x.x)       xx.x(x.x)      

                                    median               xx.x             xx.x

                                    Min, Max          xx,  xx          xx, xx

                                     95% CI          xx.x, xx.x     xx.x, xx.x       -xx.x, -x.x

                                     P-value                                                   <0.0001

                        A                 n                  xx                  xx                 -xx

                                    mean (SD)      xx.x(x.x)       xx.x(x.x)      

                                    median               xx.x             xx.x

                                    Min, Max          xx,  xx          xx, xx

                                     95% CI          xx.x, xx.x     xx.x, xx.x       -xx.x, -x.x

                                     P-value                                                   <0.0001

 

                        B                 n                  xx                  xx                 -xx

                                    mean (SD)      xx.x(x.x)       xx.x(x.x)      

                                    median               xx.x             xx.x

                                    Min, Max          xx,  xx          xx, xx

                                     95% CI          xx.x, xx.x     xx.x, xx.x       -xx.x, -x.x

                                     P-value                                                   <0.0001

 

Repeat for parameter OCDT

 

Not sure if this is possible. 

I get close to what I want using proc univariate but the output just looks like raw data. I prefer the cleaner look in proc means.

1 ACCEPTED SOLUTION

Accepted Solutions
SASKiwi
PROC Star

You can get both levels of data in one PROC SUMMARY. Run your second program:

proc means data= have n min max median mean stddev maxdec=1 ;
class con parameter_n parameter site ;
var score;
output out=bysite;
run;

Then examine the output dataset BYSITE: _TYPE_ = 15 rows will contain your lowest level of data (by site) and _TYPE_ = 14 rows will contain your next lowest level of data (by parameter).

View solution in original post

2 REPLIES 2
SASKiwi
PROC Star

You can get both levels of data in one PROC SUMMARY. Run your second program:

proc means data= have n min max median mean stddev maxdec=1 ;
class con parameter_n parameter site ;
var score;
output out=bysite;
run;

Then examine the output dataset BYSITE: _TYPE_ = 15 rows will contain your lowest level of data (by site) and _TYPE_ = 14 rows will contain your next lowest level of data (by parameter).

ballardw
Super User

P-value for what test?

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 2 replies
  • 1285 views
  • 0 likes
  • 3 in conversation