BookmarkSubscribeRSS Feed
radhikaa4
Calcite | Level 5

Hi I currently have a data set where I am trying to get the proc means for all numeric variables - n, mean, median, std, min, max, and confidence intervals

 

Here is the code I wrote:

 

proc means data=test n mean lclm uclm alpha=0.05 median min max missing ;
output out=test_stat; 
by group;
var
time1 time2 time3 time4;
run;

 

The code works in the result viewer but when i look at test_stat (it has not included upper and lower confidence intervals)

 

Any help would be great!

 

Thanks

3 REPLIES 3
novinosrin
Tourmaline | Level 20

 

ods output summary=test_stat(drop=_control_);

proc means data=test n mean lclm uclm alpha=0.05 median min max missing stackodsoutput ;
by group;
var
time1 time2 time3 time4;
run;
stackodsoutput 
PaigeMiller
Diamond | Level 26
proc means data=test;
by group;
var time1 time2 time3 time4;
output out=test_stat  n= mean= lclm= uclm= median= min= max= missing=/autoname; 
run;
--
Paige Miller
ed_sas_member
Meteorite | Level 14

Hi @radhikaa4 

 

In the OUTPUT statement, you need to specify the column name to retrieve each statistic :

output out=test_stat n= mean= median= std= min= max= lclm= uclm= / autoname; 

You can also personalize the names of the new columns, e.g.:

 

output out=test_stat n=(n_time1 n_time2 n_time3 n_time4) ...; 

 

NB: in the VAR Statement, you can put _NUMERIC_ to mention all numeric variables instead of time1 time2 time3 time4, assuming there is no other numeric variable in your input dataset.

 

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 518 views
  • 0 likes
  • 4 in conversation