2014年4月22日 星期二

準備Base programming 筆記_簡單的分析統計

PROC MEANS <DATA=SAS-data-set>
<statistic-keyword(s)> <option(s)>;
  • 預設會出報表,但可用NOPRINT 不出報表。
  • 報表的小數位
    • proc means data=sasuser.diabetes min max maxdec=1;
      run;
  • Group Processing,Class 與 BY
    • Class 不必先 sort,報表集合為一張
    • By 必先sort,報表分成N張,但總分層較多時,速度較快
  • OUTPUT OUT=SAS-data-set STATISTIC=new_variable(s);
    • var arterial heart cardiac urinary;
      output out=test mean=Ave_1 Ave_2 ;
      • Ave_1 Ave_2 是依VAR的順序,先到先贏,即arterial heart ,而 cardiac urinary 就沒有輸出。
      • STATISTIC=new_variable(s) 可指定不只一組,不指定就是全部變項的全部統計值都輸出。

PROC SUMMARY
  • 大致用法同上,但預設無報表,要用 PRINT (option)才會出表

PROC FREQ
  • / nofreq nopercent norow nocol missing
  • tables sex*weight*height;
    N way table 會先以 sex進行分層,輸出weight*height的表(frequency, percent, row pct, column pct)
  • tables sex*weight*height / list;
    只輸出 frequency,與其相關的percent, cumulative frequency, cumulative percent
  • tables sex*weight*height / crosslist;
    以List的方式,輸出與N way table相同的表,支援用 Proc template進行修改。

沒有留言: