Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
434 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 Answer

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;

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...