SAS:两个变量的平均值、中位数、最大值和百分位数 [英] SAS: Mean, median, max and percentiles by two variables

查看:119
本文介绍了SAS:两个变量的平均值、中位数、最大值和百分位数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个由 5 列构成的数据集.月份、用户、Num1、Num2、Num3.

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

我正在尝试为每个 Num1 Num2 和 Num3 计算 Month 和 User 的每个排列的平均值、中位数、最大值、第 25 个和第 75 个百分位数.

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.

我尝试过 proc 单变量,但如果不为每个月和用户排列创建宏和手动步骤,我就无法做到.

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

我的理想输出如下所示,并为 Num1 Num2 Num3 单独输出:http://i.imgur.com/YC67LV1.png

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

谢谢!

推荐答案

PROC Means 做你想做的事.

PROC Means does what you want.

这是 SASHELP.SHOES 示例数据集的示例.

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;

这篇关于SAS:两个变量的平均值、中位数、最大值和百分位数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆