markdown 在SAS中计算平均值

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 在SAS中计算平均值相关的知识,希望对你有一定的参考价值。

# Calculating mean in SAS

To calculate mean simply use **proc means**

```sas
proc means data = work.test;
var ratings;
run;
```

This will give mean of ratings only. 

Mean of sorted data.

```sas
proc means data = work.test;
var ratings;
by post;
run;
```

Above code throws error because data is not sorted. To use **by** sorting is required. 

Thus, sorting data:

```sas
proc sort data=work.test;
by post;
run;
```

# Printing only mean

```sas 
proc means data = work.test mean;
var rating;
class post;
run;
```

# Printing mean max min std

```sas 
proc means data = work.test mean min max std;
var rating;
class post;
run;
```

# Printing mean min max std meadian sum

```sas 
proc means data = work.test mean min max std median sum;
var rating;
class post;
run;
```

以上是关于markdown 在SAS中计算平均值的主要内容,如果未能解决你的问题,请参考以下文章

Lesson 3 SAS实用函数

markdown 在SAS中打印

markdown 如何计算给定列表中的数字平均值

创建 SAS 宏来处理任意数量的变量

创建SAS宏以处理任意数量的变量

markdown 在SAS中创建/导入数据