/*------------------------------------------------------------*
* program:     cdisc109.sas                                    *
* Description: Case #109. AE Death (R4102) For AE domains, this identifies records that violate the condition *
*              [Results in Death='Y'], limited to records where [Outcome of Adverse Event='FATAL'].*
* By:          Sy Truong, 10/14/2009                          *
*-------------------------------------------------------------*/
 
libname templib '../data';

*** Create some data to be selected ***;
data templib.ae(label="Adverse Events");
attrib STUDYID	label="Study Identifier" length=$100;
attrib DOMAIN	label="Domain Abbreviation" length=$100;
attrib USUBJID	label="Unique Subject Identifier" length=$100;
attrib AESEQ	label="Sequence Number" length=8;
attrib AEGRPID	label="Group ID" length=$100;
attrib AEREFID	label="Reference ID" length=$100;
attrib AESPID	label="Sponsor-Defined Identifier" length=$100;
attrib AETERM	label="Reported Term for the Adverse Event" length=$100;
attrib AEMODIFY	label="Modified Reported Term" length=$100;
attrib AEOUT	label="Outcome of Adverse Event" length=$100;
attrib AESDTH	label="Results in Death" length=$100;

STUDYID='test';DOMAIN='test';USUBJID='test';AESEQ=1;AEGRPID='test';AEREFID='test';AESPID='test';AETERM='term1';AEMODIFY='test';AEDECOD='decode1';
AEOUT="FATAL";AESDTH="N";output;
STUDYID='test';DOMAIN='test';USUBJID='test';AESEQ=1;AEGRPID='test';AEREFID='test';AESPID='test';AETERM='term2';AEMODIFY='test';AEDECOD='decode2';
AEOUT="FATAL";AESDTH="Y";output;
STUDYID='test';DOMAIN='test';USUBJID='test';AESEQ=1;AEGRPID='test';AEREFID='test';AESPID='test';AETERM='term3';AEMODIFY='test';AEDECOD='decode3';
AEOUT="NOT RECOVERED/NOT RESOLVED";AESDTH="N";output;
STUDYID='test';DOMAIN='test';USUBJID='test';AESEQ=1;AEGRPID='test';AEREFID='test';AESPID='test';AETERM='term4';AEMODIFY='test';AEDECOD='decode4';
AEOUT="UNKNOW";AESDTH="N";output;
STUDYID='test';DOMAIN='test';USUBJID='test';AESEQ=1;AEGRPID='test';AEREFID='test';AESPID='test';AETERM='term5';AEMODIFY='test';AEDECOD='decode5';
AEOUT="FATAL";AESDTH="Y";output;
STUDYID='test';DOMAIN='test';USUBJID='test';AESEQ=1;AEGRPID='test';AEREFID='test';AESPID='test';AETERM='term6';AEMODIFY='test';AEDECOD='';
AEOUT="FATAL";AESDTH="Y";output;
STUDYID='test';DOMAIN='test';USUBJID='test';AESEQ=1;AEGRPID='test';AEREFID='test';AESPID='test';AETERM='term7';AEMODIFY='test';AEDECOD='decode6';
AEOUT="FATAL";AESDTH="Y";output;
STUDYID='test';DOMAIN='test';USUBJID='test';AESEQ=1;AEGRPID='test';AEREFID='test';AESPID='test';AETERM='term8';AEMODIFY='test';AEDECOD='decode7';
AEOUT="FATAL";AESDTH="Y";output;
STUDYID='test';DOMAIN='test';USUBJID='test';AESEQ=1;AEGRPID='test';AEREFID='test';AESPID='test';AETERM='term9';AEMODIFY='test';AEDECOD='decode8';
AEOUT="FATAL";AESDTH="N";output;
STUDYID='test';DOMAIN='test';USUBJID='test';AESEQ=1;AEGRPID='test';AEREFID='test';AESPID='test';AETERM='term10';AEMODIFY='test';AEDECOD='';
AEOUT="FATAL";AESDTH="Y";output;
STUDYID='test';DOMAIN='test';USUBJID='test';AESEQ=1;AEGRPID='test';AEREFID='test';AESPID='test';AETERM='term11';AEMODIFY='test';AEDECOD='';
AEOUT="FATAL";AESDTH="Y";output;
run;
%cdisc(datlib=templib,datname=ae);
