第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

SAS Proc Means

SAS Day 27: Proc Means

We use Statistical summary to demonstrate the mean, median, max, min, Q1, Q3… 
In SAS we can either use Proc Means or Proc Univariate to achieve the goals.
Today we will introduce how to generate statistical summary using Proc Means.

Basic Syntax:

proc means data= dummy noprint;
var age; /*Any continuous variable: age, weight, height*/
where &cond; /*Subset the population, ex: Safety population="Y"*/
output out=temp1 n=n mean=mean std=std min=min median=median max=max q1=q1 q3=q3; 
/*Any statistical meausures we need to present*/
run;

The above step will generate the basic summary, we can manipulate with the format a little bit so we can present the data in a nice way.

[caption id=“attachment_1885” align=“alignnone” width=“560”]image

95839 / Pixabay[/caption]

Basic Syntax:

data test;
length col $100.;
set temp1;
  ord=0.5; label="Summary Statistics of Age"; output;
  ord=1; label=' N'; col=strip(put(n,best8.)); output;
  ord=2; label=' Mean'; col=strip(put(mean,8.1)); output;
  ord=3; label=' STDEV'; col=strip(put(std,8.2)); output;
  ord=4; label=' Median'; col=strip(put(median,8.1)); output;
  *ord=4.5; hd=' Q1, Q3'; col1=strip(put(q1,8.1))||', '||strip(put(q3,8.1)); output;
  ord=5; label=' Min, Max'; col=strip(put(min,8.1))||', '||strip(put(max,8.1)); output;
  keep  ord label col;
run;

Note: we can tailor the decimal points “8.1” or “8.2” based on the output requirement.

Now, finally, we can demonstrate our data to the audience.

image

Bonus Macro Coding:

Most of the time we need to develop Statistical summary for many continuous variables, such as Age, Height, Weight, Disease Lines or and so on. Therefore, it would be extremely useful if we modify the previous code a little to create a Macro Proc Means.

Basic Syntax:

%macro mean(var=, out=,  cond=);
proc means data=test noprint;
var &var;
where &cond;

output out=temp n=n mean=mean std=std min=min median=median max=max q1=q1 q3=q3;
run;

data &out;
 set temp;
  ord=0.5; label="Summary Statistics of Age"; output;
  ord=1; label=' N'; col=strip(put(n,best8.)); output;
  ord=2; label=' Mean'; col=strip(put(mean,8.1)); output;
  ord=3; label=' STDEV'; col=strip(put(std,8.2)); output;
  ord=4; label=' Median'; col=strip(put(median,8.1)); output;
 *ord=4.5; hd='  Q1, Q3'; col1=strip(put(q1,best8.)))||', '||strip(put(q3,best8.))); output;
  ord=5; label=' Min, Max'; col=strip(put(min,8.1))||', '||strip(put(max,8.1)); output;
  keep  ord label col;
run;
%mend;

Now we can just use the macro to call all the desired variables.

%mean (var=height, out=age, cond= safety=“y”)

Happy Studying! 😇

點擊查看更多內容
TA 點贊

若覺得本文不錯,就分享一下吧!

評論

作者其他優(yōu)質文章

正在加載中
  • 推薦
  • 評論
  • 收藏
  • 共同學習,寫下你的評論
感謝您的支持,我會繼續(xù)努力的~
掃碼打賞,你說多少就多少
贊賞金額會直接到老師賬戶
支付方式
打開微信掃一掃,即可進行掃碼打賞哦
今天注冊有機會得

100積分直接送

付費專欄免費學

大額優(yōu)惠券免費領

立即參與 放棄機會
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號

舉報

0/150
提交
取消