/*------------------------------------------------------------*
* program:     cdisc72.sas                                    *
* Description: Case #72. DM Sequence For All domains, this identifies non-Sequence*
*              Number domain subjects not found in the Demographics domain.*
* By:          Sy Truong, 10/14/2009                          *
*-------------------------------------------------------------*/
 
libname templib '../data';

*** Create some data to be selected ***;
data templib.dm(label="Demographics");
attrib STUDYID   label="Study Identifier" length=$100;
attrib DOMAIN  	 label="Domain Abbreviation" length=$100;
attrib USUBJID   label="Unique Subject Identifier" length=$100;
attrib SUBJID  	 label="Subject Identifier for the Study" length=$100;
attrib RFSTDTC   label="Subject Reference Start Date/Time" length=$100;
attrib RFENDTC   label="Subject Reference End Date/Time" length=$100;
attrib SITEID  	 label="Study Site Identifier" length=$100;
attrib INVID  	 label="Investigator Identifier" length=$100;
attrib INVNAM  	 label="Investigator Name" length=$100;
attrib BRTHDTC   label="Date/Time of Birth" length=$100;
attrib AGE  	 label="Age" length=8;
attrib AGEU  	 label="Age Units" length=$100;
attrib SEX  	 label="Sex" length=$100;
attrib RACE  	 label="Race" length=$100;
attrib ETHNIC  	 label="Ethnicity" length=$100; 
attrib ARMCD  	 label="Planned Arm Code" length=$100;
attrib ARM  	 label="Description of Planned Arm" length=$100;
attrib COUNTRY   label="Country" length=$100;
attrib DMDTC  	 label="Date/Time of Collection" length=$100;
attrib DMDY  	 label="Study Day of Collection" length=8;
STUDYID ='test'; 
DOMAIN='test';USUBJID='101';  SUBJID  ='test';RFSTDTC  ='test';RFENDTC  ='test';SITEID  ='test';INVID  ='test';INVNAM  ='test';BRTHDTC  ='test';AGE  =50;
AGEU  ='test';SEX  ='test';RACE  ='test';ETHNIC  ='test';ARMCD  ='P';ARM  ='Placebo';COUNTRY  ='test';DMDTC  ='test';DMDY  =123;
output;
STUDYID ='test';
DOMAIN='test';USUBJID='102';  SUBJID  ='test';RFSTDTC  ='test';RFENDTC  ='test';SITEID  ='test';INVID  ='test';INVNAM  ='test';BRTHDTC  ='test';AGE  =50;
AGEU  ='test';SEX  ='test';RACE  ='test';ETHNIC  ='test';ARMCD  ='';ARM  ='';COUNTRY  ='test';DMDTC  ='test';DMDY  =123;
output;
STUDYID ='test';
DOMAIN='test';USUBJID='103';  SUBJID  ='test';RFSTDTC  ='test';RFENDTC  ='test';SITEID  ='test';INVID  ='test';INVNAM  ='test';BRTHDTC  ='test';AGE  =50;
AGEU  ='test';SEX  ='test';RACE  ='test';ETHNIC  ='test';ARMCD  ='test';ARM  ='test';COUNTRY  ='test';DMDTC  ='test';DMDY  =123;
output;
STUDYID ='test';
DOMAIN='test';USUBJID='104';  SUBJID  ='test';RFSTDTC  ='test';RFENDTC  ='test';SITEID  ='test';INVID  ='test';INVNAM  ='test';BRTHDTC  ='test';AGE  =50;
AGEU  ='test';SEX  ='test';RACE  ='test';ETHNIC  ='test';ARMCD  ='P';ARM  ='Placebo';COUNTRY  ='test';DMDTC  ='test';DMDY  =123;
output;
STUDYID ='test';
DOMAIN='test';USUBJID='105';  SUBJID  ='test';RFSTDTC  ='test';RFENDTC  ='test';SITEID  ='test';INVID  ='test';INVNAM  ='test';BRTHDTC  ='test';AGE  =50;
AGEU  ='test';SEX  ='test';RACE  ='test';ETHNIC  ='test';ARMCD  ='B';ARM  ='B';COUNTRY  ='test';DMDTC  ='test';DMDY  =123;
output;
STUDYID ='test';
DOMAIN='test';USUBJID='106';  SUBJID  ='test';RFSTDTC  ='test';RFENDTC  ='test';SITEID  ='test';INVID  ='test';INVNAM  ='test';BRTHDTC  ='test';AGE  =50;
AGEU  ='test';SEX  ='test';RACE  ='test';ETHNIC  ='test';ARMCD  ='A';ARM  ='A';COUNTRY  ='test';DMDTC  ='test';DMDY  =123;
output;
run;

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 AEDECOD	label="Dictionary-Derived Term" length=$100;
attrib AESER	label="Serious Event" length=$1;
attrib AESCAN	label="Involves Cancer" length=$1;
attrib AESCONG	label="Congenital Anomaly or Birth Defect" length=$1;
attrib AESDISAB	label="Persist or Signif Disability/Incapacity" length=$1;
attrib AESDTH	label="Results in Death" length=$1;
attrib AESHOSP	label="Requires or Prolongs Hospitalization" length=$1;
attrib AESLIFE	label="Is Life Threatening" length=$1;
attrib AESOD	label="Occurred with Overdose" length=$1;
attrib AESMIE	label="Other Medically Important Serious Event" length=$1;


STUDYID='test';DOMAIN='test';USUBJID='101';AESEQ=1;AEGRPID='test';AEREFID='test';AESPID='test';AETERM='term1';AEMODIFY='test';AEDECOD='decode1';
AESER = 'Y';AESCAN = 'Y';AESCONG = 'Y';AESDISAB = 'Y';AESDTH = 'N';AESHOSP = 'Y';AESLIFE = 'Y';AESOD = 'N';AESMIE = 'Y';
output;
STUDYID='test';DOMAIN='test';USUBJID='102';AESEQ=1;AEGRPID='test';AEREFID='test';AESPID='test';AETERM='term2';AEMODIFY='test';AEDECOD='decode2';
AESER = 'Y';AESCAN = 'Y';AESCONG = 'Y';AESDISAB = 'Y';AESDTH = 'Y';AESHOSP = 'N';AESLIFE = 'Y';AESOD = 'Y';AESMIE = 'Y';
output;
STUDYID='test';DOMAIN='test';USUBJID='101';AESEQ=1;AEGRPID='test';AEREFID='test';AESPID='test';AETERM='term3';AEMODIFY='test';AEDECOD='decode3';
AESER = 'Y';AESCAN = 'Y';AESCONG = 'Y';AESDISAB = 'Y';AESDTH = 'Y';AESHOSP = 'Y';AESLIFE = 'Y';AESOD = 'N';AESMIE = 'N';
output;
STUDYID='test';DOMAIN='test';USUBJID='106';AESEQ=1;AEGRPID='test';AEREFID='test';AESPID='test';AETERM='term4';AEMODIFY='test';AEDECOD='decode4';
AESER = 'N';AESCAN = 'N';AESCONG = 'N';AESDISAB = 'N';AESDTH = 'N';AESHOSP = 'N';AESLIFE = 'N';AESOD = 'N';AESMIE = 'N';
output;
STUDYID='test';DOMAIN='test';USUBJID='102';AESEQ=1;AEGRPID='test';AEREFID='test';AESPID='test';AETERM='term5';AEMODIFY='test';AEDECOD='decode5';
AESER = 'Y';AESCAN = 'N';AESCONG = 'N';AESDISAB = 'N';AESDTH = 'Y';AESHOSP = 'N';AESLIFE = 'N';AESOD = 'N';AESMIE = 'N';
output;
STUDYID='test';DOMAIN='test';USUBJID='111';AESEQ=1;AEGRPID='test';AEREFID='test';AESPID='test';AETERM='term6';AEMODIFY='test';AEDECOD='decode5';
AESER = 'Y';AESCAN = 'Y';AESCONG = 'Y';AESDISAB = 'Y';AESDTH = 'Y';AESHOSP = 'Y';AESLIFE = 'Y';AESOD = 'N';AESMIE = 'N';
output;
STUDYID='test';DOMAIN='test';USUBJID='103';AESEQ=1;AEGRPID='test';AEREFID='test';AESPID='test';AETERM='term7';AEMODIFY='test';AEDECOD='decode6';
AESER = 'Y';AESCAN = 'Y';AESCONG = 'Y';AESDISAB = 'Y';AESDTH = 'Y';AESHOSP = 'Y';AESLIFE = 'Y';AESOD = 'N';AESMIE = 'N';
output;
STUDYID='test';DOMAIN='test';USUBJID='111';AESEQ=1;AEGRPID='test';AEREFID='test';AESPID='test';AETERM='term8';AEMODIFY='test';AEDECOD='decode7';
AESER = 'Y';AESCAN = 'Y';AESCONG = 'Y';AESDISAB = 'Y';AESDTH = 'Y';AESHOSP = 'N';AESLIFE = 'Y';AESOD = 'N';AESMIE = 'N';
output;
STUDYID='test';DOMAIN='test';USUBJID='104';AESEQ=1;AEGRPID='test';AEREFID='test';AESPID='test';AETERM='term9';AEMODIFY='test';AEDECOD='decode8';
AESER = 'Y';AESCAN = 'Y';AESCONG = 'Y';AESDISAB = 'Y';AESDTH = 'Y';AESHOSP = 'N';AESLIFE = 'Y';AESOD = 'Y';AESMIE = 'N';
output;
STUDYID='test';DOMAIN='test';USUBJID='102';AESEQ=1;AEGRPID='test';AEREFID='test';AESPID='test';AETERM='term10';AEMODIFY='test';AEDECOD='decode5';
AESER = 'Y';AESCAN = 'Y';AESCONG = 'Y';AESDISAB = 'Y';AESDTH = 'Y';AESHOSP = 'N';AESLIFE = 'Y';AESOD = 'N';AESMIE = 'N';
output;
STUDYID='test';DOMAIN='test';USUBJID='103';AESEQ=1;AEGRPID='test';AEREFID='test';AESPID='test';AETERM='term11';AEMODIFY='test';AEDECOD='decode5';
AESER = 'Y';AESCAN = 'N';AESCONG = 'N';AESDISAB = 'N';AESDTH = 'N';AESHOSP = 'Y';AESLIFE = 'N';AESOD = 'N';AESMIE = 'N';
output;
run;

%cdisc(datlib=templib,datname=ae);
