You are on page 1of 2

libname satthi "C:\Users\sathish\Desktop\DESKTOP 1-6\sas assignments\raw_and_der \raw_and_der\der"; proc format; value group -0.

50="Number of Subjects Who Completed the Study" -0.25=" " 0="Number of Subjects Who Prematurely Terminated the Study" 0.25=" " 0.50="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 SATHISH; set satthi.admin; if itt=1; run; proc freq data=sathish noprint; tables trt*compyn/out=prasad; where compyn=1; run; proc freq data=sathish noprint; tables trt*compyn/out=prasad1; where compyn=2; run; proc freq data=sathish noprint; tables trt*reason/out=prasad2; where compyn=2; run; data BSP; set prasad prasad1 prasad2; run; proc freq data=sathish noprint; tables trt/out=BSP1 (rename=(count=bign)); run; proc sort data=BSP1; by trt;run; proc sort data=BSP; by trt;run; data MERGE_F; merge BSP BSP1; by trt; if compyn=1 then reason=-0.50; else if compyn=2 then reason=0; value=put(count,4.)||" ("||put((count/bign)*100,5.1)||"%)"; run;

proc sort data=merge_f;by reason trt;run; proc transpose data=merge_f out=final_tr prefix=trt; var value; id trt; by reason; run; data final_t; set final_tr; label=put(reason,group.); run; data dummy; do reason=-0.50,-0.25,0,0.25,0.5,1 to 7; label=put(reason,group.); output; end; run; proc sort data=final_tr;by reason;run; proc sort data=dummy;by reason;run; data finaltab; merge final_tr dummy; by reason; run; data finaledit; set finaltab; drop reason _NAME_; statistics="n (%)"; run; data finaledit2; set finaltab; rename _NAME_=statistics; if _NAME_=value then statistics="n (%)"; else if _NAME_=" " then statistics=" "; run;

You might also like