You are on page 1of 2

libname BANDARU "C:\Users\sathish\Desktop\DESKTOP 1-6\sas assignments\raw_and_de r\raw_and_der\der"; /**/ /*proc contents data=bandaru.

_all_;*/ /*run;*/ proc format; value dummy -1="Number of Subjects Who Completed the Study" -0.5=" " 0="Number of Subjects Who Prematurely Terminated the Study" 0.25=" " 0.5="Primary Reason for Premature Study Termination:" 1="Adverse Event" 2="Lack of Efficacy" 3="Lost to Follow-Up" 4="Withdrew Consent" 5="Administrative" 6="Protocol Violation" 7="Missing" ; run; data ADMIN; set bandaru.admin; keep compyn trt itt pt reason reasonc; where itt=1; run; proc sql; create table bign as select trt,count(pt) as pct from admin group by trt; create table counts as select trt,count(pt) as count, "Number of Subjects Who Completed the Study" as l abel, -1 as ord from admin where compyn=1 group by trt outer union corr select trt,count(pt) as count, "Number of Subjects Who Prematurely Terminated th e Study" as label, 0 as ord from admin where compyn=2 group by trt outer union corr select trt,count(pt) as count, reasonc as label, reason as ord from admin where compyn=2 group by trt,reason,reasonc; quit; proc sort data=counts;by trt;run; proc sort data=bign;by trt;run; data BSP; merge counts bign; by trt; if count not in(.,0) and pct not in(.,0) then value=put(count,4.)||" ("||put((co unt/pct)*100,5.1)||"%)"; else if count=0 then value=" 0"; run;

proc sort data=BSP;by ord label trt;run; proc transpose data=BSP out=final; by ord label; var value; id trt; run; data final_dummy; do ord=-1,-0.5,0,0.25,0.5,1 to 7; label=put(ord,dummy.); output; end; run; proc sort data=final;by ord label;run; proc sort data=final_dummy;by ord label;run; data BSSP; merge final_dummy final; by ord label; run; data FINAL_f; set bssp; drop ord _NAME_; run;

You might also like