/*------------------------------------------------------------*
* program:     cdisc27.sas                                     *
* Description: Case #27. DM Arm Code For DM domain, this identifies records that violate the condition *
*              [If Arm Code='SCRNFAIL' then Description of Arm must equal 'Screen Failure', and vice versa].*
* 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='test';  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='test';  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  ='SCRNFAIL';ARM  ='test';COUNTRY  ='test';DMDTC  ='test';DMDY  =123;
output;
STUDYID ='test';
DOMAIN='test';USUBJID='test';  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='test';  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  ='Screen Failure';COUNTRY  ='test';DMDTC  ='test';DMDY  =123;
output;
STUDYID ='test';
DOMAIN='test';USUBJID='test';  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='test';  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  ='SCRNFAIL';ARM  ='Screen Failure';COUNTRY  ='test';DMDTC  ='test';DMDY  =123;
output;
run;
%cdisc(datlib=templib,datname=dm);
