***********************************************************************************************; ** Program Name : adae-s092-all-unb-p3-saf.sas **; ** Date Created : 23Mar2021 **; ** Programmer Name : LIL233 **; ** Purpose : Create adae-s092-all-unb-p3-saf **; ** Input data : adae **; ** Output data : adae-s092-all-unb-p3-saf.html **; ***********************************************************************************************; options mprint mlogic symbolgen mprint symbolgen mlogic nocenter missing=" "; **Setup the environment**; %let prot=/Volumes/app/cdars/prod/sites/cdars4/prjC459/nda2_unblinded_esub/bla_esub_adam/saseng/cdisc3_0; libname datvprot "&prot./data_vai" access=readonly; %let codename=adae-s092-all-unb-p3-saf; %let outlog=&prot./analysis/esub/logs/&codename..log; %let outtable=&prot./analysis/esub/output/&codename..html; proc printto log="&outlog." new; run; data g_adsl_dsin; set datvprot.adsl; where saffl="Y" and agegr1n in (2, 5) and phasen in (2, 3, 4) and MULENRFL ne "Y" and HIVFL ne "Y" and (VAX101DT ne . and BDCSRDT ne .); run; data g_a_dsin; set datvprot.adae; analysis_subset='Y'; where AECAT='ADVERSE EVENT' and saffl="Y" and PHASEN in (2, 3, 4) and vphasen>0 and agegr1n in (2, 5) and . 0 then call symput('_trtlb'||compress(put(_trt, 4.)), trim(left(_str))); end; run; proc sql; create table trtbign as select distinct _trt, newtrt, compress(put(count(*), 5.) ) as bign, coalesce(sum(FUP1UNB)/(365.25*100), 0) as tenum from (select distinct USUBJID, _trt, newtrt, FUP1UNB from _data1 where NEWTRTN is not missing) group by _trt; quit; proc sort data=_data1 out=_bydat1(keep=_datasrt _dummyby) nodupkey; by _datasrt; run; data _bydat1; set _bydat1 end=eof; by _datasrt; retain _preby 0; drop _preby; _byvar1=0; if eof then do; call symput("_preby1", compress(put(_byvar1, 4.))); if 0=0 then output; end; run; data _bydat1; set _bydat1; by _datasrt; length _bycol _byindnt $50 _bylast $10; _bycol=" "; _byindnt=" "; _bylast=" "; proc sort; by _datasrt; run; proc sort data=_data1; by _trt usubjid aeterm descending ATOXGRN; run; data tab1; set _data1; where analysis_subset='Y' and aeterm ne ''; by _trt usubjid aeterm descending ATOXGRN; if last.usubjid then do; catvar=1; output; end; if last.ATOXGRN then do; _catvar=1; output; end; run; data rel_tab1; set _data1; by _trt usubjid aeterm descending ATOXGRN; where analysis_subset='Y' and aeterm ne '' and upcase(AREL)='RELATED'; if last.usubjid then do; catvar=1+100; output; end; if last.ATOXGRN then do; _catvar=1+100; output; end; run; data sev_tab1; set _data1; by _trt usubjid aeterm descending ATOXGRN; where analysis_subset='Y' and aeterm ne '' and ATOXGRN=3; if last.usubjid then do; catvar=1+200; output; end; if last.ATOXGRN then do; _catvar=1+200; output; end; run; data lif_tab1; set _data1; by _trt usubjid aeterm descending ATOXGRN; where analysis_subset='Y' and aeterm ne '' and (atoxgr="GRADE 4"); if last.usubjid then do; catvar=1+300; output; end; if last.ATOXGRN then do; _catvar=1+300; output; end; run; data tab2; set _data1; where analysis_subset='Y' and aeser='Y'; by _trt usubjid aeterm descending ATOXGRN; if last.usubjid then do; catvar=2; output; end; if last.ATOXGRN then do; _catvar=2; output; end; run; data rel_tab2; set _data1; by _trt usubjid aeterm descending ATOXGRN; where analysis_subset='Y' and aeser='Y' and upcase(AREL)='RELATED'; if last.usubjid then do; catvar=2+100; output; end; if last.ATOXGRN then do; _catvar=2+100; output; end; run; data sev_tab2; set _data1; by _trt usubjid aeterm descending ATOXGRN; where analysis_subset='Y' and aeser='Y' and ATOXGRN=3; if last.usubjid then do; catvar=2+200; output; end; if last.ATOXGRN then do; _catvar=2+200; output; end; run; data lif_tab2; set _data1; by _trt usubjid aeterm descending ATOXGRN; where analysis_subset='Y' and aeser='Y' and (atoxgr="GRADE 4"); if last.usubjid then do; catvar=2+300; output; end; if last.ATOXGRN then do; _catvar=2+300; output; end; run; data tab6; set _data1; where analysis_subset='Y' and (upcase(aeacn)='DRUG WITHDRAWN' or aesubjdc='Y'); by _trt usubjid aeterm descending ATOXGRN; if last.usubjid then do; catvar=6; output; end; if last.ATOXGRN then do; _catvar=6; output; end; run; data rel_tab6; set _data1; by _trt usubjid aeterm descending ATOXGRN; where analysis_subset='Y' and (upcase(aeacn)='DRUG WITHDRAWN' or aesubjdc='Y') and upcase(AREL)='RELATED'; if last.usubjid then do; catvar=6+100; output; end; if last.ATOXGRN then do; _catvar=6+100; output; end; run; data sev_tab6; set _data1; by _trt usubjid aeterm descending ATOXGRN; where analysis_subset='Y' and (upcase(aeacn)='DRUG WITHDRAWN' or aesubjdc='Y') and ATOXGRN=3; if last.usubjid then do; catvar=6+200; output; end; if last.ATOXGRN then do; _catvar=6+200; output; end; run; data lif_tab6; set _data1; by _trt usubjid aeterm descending ATOXGRN; where analysis_subset='Y' and (upcase(aeacn)='DRUG WITHDRAWN' or aesubjdc='Y') and (atoxgr="GRADE 4"); if last.usubjid then do; catvar=6+300; output; end; if last.ATOXGRN then do; _catvar=6+300; output; end; run; data tab7; set _data1; where analysis_subset='Y' and (upcase(AEOUT)="FATAL"); by _trt usubjid aeterm descending ATOXGRN; if last.usubjid then do; catvar=7; output; end; if last.ATOXGRN then do; _catvar=7; output; end; run; data rel_tab7; set _data1; by _trt usubjid aeterm descending ATOXGRN; where analysis_subset='Y' and (upcase(AEOUT)="FATAL") and upcase(AREL)='RELATED'; if last.usubjid then do; catvar=7+100; output; end; if last.ATOXGRN then do; _catvar=7+100; output; end; run; data sev_tab7; set _data1; by _trt usubjid aeterm descending ATOXGRN; where analysis_subset='Y' and (upcase(AEOUT)="FATAL") and ATOXGRN=3; if last.usubjid then do; catvar=7+200; output; end; if last.ATOXGRN then do; _catvar=7+200; output; end; run; data lif_tab7; set _data1; by _trt usubjid aeterm descending ATOXGRN; where analysis_subset='Y' and (upcase(AEOUT)="FATAL") and (atoxgr="GRADE 4"); if last.usubjid then do; catvar=7+300; output; end; if last.ATOXGRN then do; _catvar=7+300; output; end; run; data _data1; set _data1(in=a) tab1 sev_tab1 rel_tab1 lif_tab1 tab2 sev_tab2 rel_tab2 lif_tab2 tab6 sev_tab6 rel_tab6 lif_tab6 tab7; if a then do; catvar=0; _catvar=0; end; if _catvar ne . then catvar=.; run; proc format cntlout=tmpfmt; select catlbl; run; data _anal1; length CATVAR 8; set _data1; where same and CATVAR is not missing; _blcksrt=0; _cnt=1; _cat=1; if _trt <=0 then delete; output; run; proc sort data=_anal1; by _datasrt _blcksrt CATVAR _trt _cat; run; proc sort data=_anal1 out=_temp91 nodupkey; by _datasrt _blcksrt _cat CATVAR _trt USUBJID; run; proc freq data=_temp91; format CATVAR; tables _datasrt*_blcksrt*_cat * CATVAR * _trt / sparse norow nocol nopercent out=_pct1(drop=percent); run; /* proc sort data =_anal1 out = _denom1_1(keep=_datasrt _cat) nodupkey; */ /* by _datasrt _cat; */ /* run; */ /* */ /* data _denom1_1; */ /* set _denom1_1; */ /* by _datasrt _cat; */ /* label count = 'count'; */ /* _trt = 1; */ /* output; */ /* _trt = 2; */ /* output; */ /* run; */ /* */ /* proc sql; */ /* create table _denom1 as select a.*, b.bign as count from _denom1_1 as a left join trtbign as b on a._trt=b._trt; */ /* quit; */ /* */ data rep1; set _pct1; length _rwlabel $200. _cvalue $50.; if catvar<100 then do; _rwlabel=strip(put(CATVAR, catlbl.)); /* grp=1; */ end; else do; _rwlabel=repeat(byte(160), 2)|| strip(put(CATVAR, scatlbl.)); /* grp=2; */ end; if catvar in (1, 101, 201, 301) then _fixvar=1; else if catvar in (2, 102, 202, 302) then _fixvar=2; else if catvar in (6, 106, 206, 306) then _fixvar=3; else if catvar in (7) then _fixvar=4; _cvalue=strip(put(count, best.)); run; proc sql; create table rep2 as select a.*, b.bign, b.newtrt, b.tenum from rep1 as a left join trtbign as b on a._trt=b._trt; quit; data rep2; set rep2; length _cpct _cvalue2 $40. CNP_CI $100.; newtrt=strip(newtrt)||"| (N(*ESC*){super a}="||strip(bign)||", TE(*ESC*){super b}="||strip(put(tenum, 8.1)) || ")"; _cvalue2=strip(put((count/TENUM), 8.1)); if count ne 0 then lcl=(cinv(0.05/2, 2*count))/(2*TENUM); else lcl=0; ucl=(cinv(1-0.05/2, 2*(count+1)))/(2*TENUM); CNP_CI=strip("(" || strip(put(lcl, 8.1)) || ",(*ESC*){nbspace 1}" || strip(put(ucl, 8.1)) || ")"); _dummy=1; proc sort; by _cat _fixvar catvar _rwlabel _trt newtrt _cvalue; run; options topmargin=0.75in bottommargin=0.75in leftmargin=0.75in rightmargin=0.75in; ; options orientation=LANDSCAPE papersize="LETTER"; ods escapechar="~"; option nobyline; title1 "Incidence Rates of at Least 1 Adverse Event From Dose 1 to Unblinding Date (*ESC*){unicode 2013}"; title2 "Phase 2/3 Subjects (*ESC*){unicode 2265}16 Years of Age (*ESC*){unicode 2013} Safety Population"; footnote1 "%nrbquote(a.~{nbspace 5}N = number of subjects in the specified group.)"; footnote2 "%nrbquote(b.~{nbspace 5}TE = total exposure time in 100 person-years across all subjects in the specified group. Exposure time for a subject is the time from Dose 1 to the end of blinded follow-up. This value is the denominator for the incidence rate calculation.)"; footnote3 "%nrbquote(c.~{nbspace 5}n = Number of subjects reporting at least 1 occurrence of the specified event category. For "any event, " n = number of subjects reporting at least 1 occurrence of any event.)"; footnote4 "%nrbquote(d.~{nbspace 5}Incidence rate (IR) is calculated as number of subjects reporting the event/total exposure time in 100 person-years (PY) across all subjects in the specified group.)"; footnote5 "%nrbquote(e.~{nbspace 5}2-sided CI based on Poisson distribution.)"; footnote6 "%nrbquote(f.~{nbspace 5}Assessed by the investigator as related to investigational product.)"; ods html file="&outtable."; proc report data=rep2 nowd list missing contents="" split="|"; column _cat _fixvar catvar _rwlabel ("~S={just=center}Vaccine Group (as Administered)~{line}" newtrt, (_cvalue _cvalue2 cnp_ci _dummy) ); define _cat / group noprint; define _fixvar / group order=internal noprint; define catvar / group order=internal noprint; define _rwlabel / group "Adverse Event" order=data style(column)={just=left width=65mm} style(header)={just=left} left; define newtrt / across nozero "" style(column)={width=35mm leftmargin=12px} style(header)={just=center} center; define _cvalue / display nozero "n(*ESC*){super c}" style(column)={leftmargin=12px} style(header)={just=center} center; define _cvalue2 / display nozero "IR (/100(*ESC*){nbspace 1}PY)(*ESC*){super d}" style(column)={leftmargin=12px} style(header)={just=center} center; define cnp_ci / display nozero "(95% CI(*ESC*){super e})" style(column)={leftmargin=12px} style(header)={just=center} center; define _dummy / sum noprint; compute before _cat; line @1 " ~n"; endcomp; compute after _cat; line " ~n"; endcomp; run; ods html close; proc printto; run;