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.
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 ...
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.
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 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.