BookmarkSubscribeRSS Feed
abdulla
Pyrite | Level 9

Hi,

 

I have used the following code to get mean and std. I am getting results separately in 5 different tables for each group. How can I get the results in one summary table?

 

proc means data=triangle mean std;
var y;
by trt;
output out=pred2 mean= std= /autoname;
run;

 

I want results like the following. Please help

trt meanstdN
1   
2   
3   
4   
5   
4 REPLIES 4
novinosrin
Tourmaline | Level 20

i think you are missing nway option

 


proc means data=triangle mean std nway;
var y;
by trt;
output out=pred2 mean= std= /autoname;
run;
abdulla
Pyrite | Level 9

No, I am still not getting what I want. I am getting results in 5 different tables for 5trt. But I want them in one table. 

PaigeMiller
Diamond | Level 26

Add to your code above

 

proc print data=pred2;
run;
--
Paige Miller
ballardw
Super User

@abdulla wrote:

Hi,

 

I have used the following code to get mean and std. I am getting results separately in 5 different tables for each group. How can I get the results in one summary table?

 

proc means data=triangle mean std;
var y;
by trt;
output out=pred2 mean= std= /autoname;
run;

 

I want results like the following. Please help

trt  mean std N
1      
2      
3      
4      
5      

Try

 

CLASS trt;

 

BY does what you are saying: it creates separate output for each level of the BY Variable. CLASS creates grouped output.

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

Discussion stats
  • 4 replies
  • 572 views
  • 0 likes
  • 4 in conversation