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

I am trying to use PROC MEANS to calculate arithmetic CV. However, it is only outputting the default statistics. I had this issue earlier with the median, where I had to do median independently then merge to other statistics. Does anyone have any insight on the possible reasoning?

 

Code: 

proc means data = have n mean std cv max min noprint;
 class  BMI PERIOD TRT;
 var CONCEN LN_CONCEN;
 output out = stats;
run;

 Thank you in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User
proc means data = have  noprint;
 class  BMI PERIOD TRT;
 var CONCEN LN_CONCEN;
 output out = stats n= mean= std= cv= max= min= /autoname;
run;

You may want the option NWAY on the Proc Statement. Your code as posted for an output set will create an overall summary record, one for each level of Bmi, each level of Period, each level of TRT, combinations of the class variables two at a time and finally all three variables. NWAY will only output the highest level of the _type_ variable or all 3 class variable combinations.

The /autoname creates the statistic variables with the variable name and the statistic suffixed, ie Concen_n Ln_concen_n Concen_mean  Ln_concen_mean ...

View solution in original post

3 REPLIES 3
Astounding
PROC Star

The statistics mentioned on the PROC statement only affect the printed report.

 

To control what goes into the output data set, you have to expand the OUTPUT statement, mentioning the names you would like to assign to every statistic in the output data set.

data_null__
Jade | Level 19
It would be nice if it worked they way you describe I have wished for that myself. I find the output produced by STACKODS option to more useful for my purposes and can be transposed to resemble the default OUT= data structure if needed.

ballardw
Super User
proc means data = have  noprint;
 class  BMI PERIOD TRT;
 var CONCEN LN_CONCEN;
 output out = stats n= mean= std= cv= max= min= /autoname;
run;

You may want the option NWAY on the Proc Statement. Your code as posted for an output set will create an overall summary record, one for each level of Bmi, each level of Period, each level of TRT, combinations of the class variables two at a time and finally all three variables. NWAY will only output the highest level of the _type_ variable or all 3 class variable combinations.

The /autoname creates the statistic variables with the variable name and the statistic suffixed, ie Concen_n Ln_concen_n Concen_mean  Ln_concen_mean ...

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!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 818 views
  • 6 likes
  • 4 in conversation