Edit

SAS: PROC TABULATE

簡易表の作成について

あまり使わないけど,探索目的で少し複雑な票を簡単に作るのは便利。

ソースコードの記載

data test ;
do id = 1 to 100 ;
 do time = 1 to 3 ;
   do trt = "T", "P" ;
           if trt="T" then do; res1=rand("Normal", 3,3) ; res2 = rand("BERNOULLI", 0.2) ;end ;
      else if trt="P" then do; res1=rand("Normal", 0,3) ; res2 = rand("BERNOULLI", 0.7) ;end ;
      output ;
   end ;
 end ;
end;
run ;

/* Descriptive Stats*/
proc tabulate data=test ;
  class trt time ;
  var res1 ;
  label res1="Response 1";
  table time, res1*trt*(N*f=5.0 mean*f=10.4) ;
run ;

/* N and percent*/
proc tabulate data=test ;
  class trt time res2;
  label res2="Response 1";
  table time ALL, res2*trt*(N*f=5.0 PCTN<trt>*f=10.1) all*f=5.0/rts=40;  *** RTS --> Wideth ***;
run ;







参照先

Search This Blog