全部版块 我的主页
论坛 休闲区 十二区 灌水吧
671 0
2016-01-05
目前用的最多的一段sas程序:来自胡大师

data DA19_6;                  /*1*/
  do sex=1 to 2;
  do dog=1 to 3;
  do time=1 to 3;
  input y @@; output;
  end;  end; end;
cards;
169.8 137.2 31.9 158.4 133.2 18.7
142.8 126.6 18.1 131.8 130.3 17.5
118.0 124.5 18.7 120.8 123.5 24.8
  ;
run;
proc mixed data=DA19_6;     /*2*/
  class sex dog time;
  model y=sex|time;
  repeated / type=VC sub=dog(sex);
  ods output fitstatistics=a;
  ods output dimensions=a1;
run;
proc mixed data=DA19_6;     /*3*/
  class sex dog time;
  model y=sex|time;
  repeated / type=CS sub=dog(sex);
  ods output fitstatistics=b;
  ods output dimensions=b1;
run;
proc mixed data=DA19_6;     /*4*/
  class sex dog time;
  model y=sex|time;
  repeated / type=UN sub=dog(sex);
  ods output fitstatistics=c;
  ods output dimensions=c1;
run;       
proc mixed data=DA19_6;     /*5*/
  class sex dog time;
  model y=sex|time;
  repeated / type=AR(1) sub=dog(sex);
  ods output fitstatistics=d;
  ods output dimensions=d1;
run;
%MACRO SHUJU(dataset,y);      /*6*/
data &dataset;
  set &dataset;
  &y=value;
  drop value;
run;
%MEND SHUJU;
%SHUJU(a,VC)   %SHUJU(b,CS)
%SHUJU(c,UN)   %SHUJU(d,AR1)
%SHUJU(a1,VC)  %SHUJU(b1,CS)
%SHUJU(c1,UN)  %SHUJU(d1,AR1)
data e;                          /*7*/
  merge a b c d;
run;
data e1;                         /*8*/
  merge a1 b1 c1 d1;
run;

proc print data=e;             /*9*/
  format _numeric_ 5.1;
run;
proc print data=e1;           /*10*/
run;

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群