现在的位置: 首页 > 综合 > 正文

One-Step Change from Baseline Calculations

2018年10月22日 ⁄ 综合 ⁄ 共 830字 ⁄ 字号 评论关闭

data test;
   input usubjid visitc $10.  visitn hr;
   cards;
1 Screening 1 91
1 Day           2 .
1 Week 1    3 68
1 Week 2    4 73
1 Week 4    5 96
2 Screening 1 .
2 Day 1       2 73
2 Week 1    3 73
2 Week 2    4 52
2 Week 4    5 59
;
run;

*** Separate baseline and post-baseline values;
data baseline postbase;
   set test;
   if visitn <= 2 then output baseline;
   else output postbase;
run;
*** Baseline value is last non-missing value before first dose;
data baseline1 (keep=usubjid hr rename=(hr=bl));
   set baseline (where=(hr is not missing));
   by usubjid visitn;
   if last.usubjid;
run;
*** Combine with post-baseline data and calculate change from baseline;
data postbase1;
   merge postbase (in=inp) baseline1 (in=inb);
   by usubjid;
   chgbl = hr - bl;
run;

 

***DOW--LOOP ****;
data postbase;
   do until (last.usubjid);
*** Only keep non-missing pre-dose values;
   set test (where=(not(visitn <= 2 and hr is missing)));
   by usubjid visitn;
   if visitn <= 2 then bl = hr;
   else do;
      chgbl = hr - bl;
      output;
   end;
   end;
run;

 

 

抱歉!评论已关闭.