/*------------------------------------------------------------*
* program:     cdisc78.sas                                    *
* Description: Case #78. DM Sequence For DM domains, this identifies Sequence Number*
*              subjects where no record for the subject is found in the Exposure 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;
run;

data templib.ex(label="Exposure");
attrib STUDYID	label="Study Identifier" length=$100;
attrib DOMAIN	label="Domain Abbreviation" length=$100;
attrib USUBJID	label="Unique Subject Identifier" length=$100;
attrib EXSEQ	label="Sequence Number" length=8;
attrib EXGRPID	label="Group ID" length=$100;
attrib EXSPID	label="Sponsor-Defined Identifier" length=$100;
attrib EXTRT	label="Name of Actual Treatment" length=$100;
attrib EXCAT	label="Category for Treatment" length=$100;
attrib EXSCAT	label="Subcategory for Treatment" length=$100;
attrib EXDOSE	label="Dose per Administration" length=8;
attrib EXDOSTXT	label="Dose Description" length=$100;
attrib EXDOSU	label="Dose Units" length=$100;
STUDYID='test';DOMAIN='test';USUBJID='101';EXSEQ=1;EXGRPID='test';EXSPID='test';EXTRT='test';EXCAT='test';EXSCAT='test';EXDOSE=1;EXDOSTXT='test';EXDOSU='test';output;
STUDYID='test';DOMAIN='test';USUBJID='101';EXSEQ=2;EXGRPID='test';EXSPID='test';EXTRT='test';EXCAT='test';EXSCAT='test';EXDOSE=1;EXDOSTXT='test';EXDOSU='test';output;
STUDYID='test';DOMAIN='test';USUBJID='101';EXSEQ=3;EXGRPID='test';EXSPID='test';EXTRT='test';EXCAT='test';EXSCAT='test';EXDOSE=1;EXDOSTXT='test';EXDOSU='test';output;
STUDYID='test';DOMAIN='test';USUBJID='103';EXSEQ=1;EXGRPID='test';EXSPID='test';EXTRT='test';EXCAT='test';EXSCAT='test';EXDOSE=1;EXDOSTXT='test';EXDOSU='test';output;
STUDYID='test';DOMAIN='test';USUBJID='103';EXSEQ=2;EXGRPID='test';EXSPID='test';EXTRT='test';EXCAT='test';EXSCAT='test';EXDOSE=1;EXDOSTXT='test';EXDOSU='test';output;
STUDYID='test';DOMAIN='test';USUBJID='106';EXSEQ=1;EXGRPID='test';EXSPID='test';EXTRT='test';EXCAT='test';EXSCAT='test';EXDOSE=1;EXDOSTXT='test';EXDOSU='test';output;
STUDYID='test';DOMAIN='test';USUBJID='106';EXSEQ=2;EXGRPID='test';EXSPID='test';EXTRT='test';EXCAT='test';EXSCAT='test';EXDOSE=1;EXDOSTXT='test';EXDOSU='test';output;
run;

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