Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
460 views
in Technique[技术] by (71.8m points)

proc - SAS: Mean, median, max and percentiles by two variables

I have a dataset structured with 5 columns. Month, User, Num1, Num2, Num3.

I'm trying to calculate, for each Num1 Num2 and Num3, the mean, median, max, 25th and 75th percentile for each permutation of Month and User.

I have tried proc univariate but I can't do it without creating a macro and manual steps for each Month and User permutation.

My ideal output would then look like this, and separate outputs for Num1 Num2 Num3: http://i.imgur.com/YC67LV1.png

Thanks!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

PROC Means does what you want.

Here is an example with the SASHELP.SHOES example dataset.

ods html;
proc means data=sashelp.shoes mean median max p25 p75;
   class region product;
   var sales inventory returns;
run;
ods html close;

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...