统计211

标题: SAS做卡方统计常用程序示例大全 [打印本页]

作者: 藤菜    时间: 2011-7-9 18:06
标题: SAS做卡方统计常用程序示例大全
本帖最后由 藤菜 于 2011-7-9 18:07 编辑

基本4格表
data m;
    do a=1 to 2;
      do b=1 to 2;
       input f@@;
       output;
     end; end;
cards;
236 416
158 160
;
      proc freq;
        weight f;
       tables  a*b/chisq;
       run;

[注:]
1 配对卡方:tables  a*b/agree;


2 RC高维列联:tables  a*b/cmh;
  双向有序等级相关,检验等级相关系数tables  a*b/chisq cmh1;
  单向列有序评分卡方检验(如剂量效应),Ridit分析的显著性检验tables  a*b/chisq cmh2;
  单向行有序,可视为双向无序的,也可秩和检验;
  双向无序相关分析,独立性检验,检验列联系数tables  a*b/chisq cmh3;


3 原始数据直接proc freq;不用权重,或者增加值均为1的变量z,proc freq;weight z;
  不需要输入百分比 tables  a*b/chisq nopct norow nocol;


4 RC联表 do a=1 to r; do b=1 to c;


5 精确概率法tables  a*b/chisq exact;


6 算相关系数和RR值和OR值用 tables  a*b/chisq measures;





欢迎光临 统计211 (http://www.tj211.com/) Powered by Discuz! X3.2