/*------------------------------------------------------------*
* program:     cdisc37.sas                                    *
* Description: Case #37. Reference Period For Events and Interventions domains, *
*              this identifies records that violate the condition *
*              [Start Relative to Reference Period in ('BEFORE','DURING','AFTER')], *
*              limited to records where [Start Relative to Reference Period is not null].*
* By:          Sy Truong, 10/14/2009                          *
*-------------------------------------------------------------*/
 
libname templib '../data';

*** Create some data to be selected ***;
data templib.ce(label="Clinical Events");
attrib STUDYID	label="Study Identifier" length=$100;
attrib DOMAIN	label="Domain Abbreviation" length=$100;
attrib USUBJID	label="Unique Subject Identifier" length=$100;
attrib CESEQ	label="Sequence Number" length=8;
attrib CEGRPID	label="Group ID" length=$100;
attrib CEREFID	label="Reference ID" length=$100;
attrib CESPID	label="Sponsor-Defined Identifier" length=$100;
attrib CETERM	label="Reported Term for the Clinical Event" length=$100;
attrib CEDECOD	label="Dictionary-Derived Term" length=$100;
attrib CECAT	label="Category for Clinical Event" length=$100;
attrib CESCAT	label="Subcategory for Clinical Event" length=$100;
attrib CEOCCUR	label="Clinical Event Occurrence" length=$100;
attrib CESTRF	label="Start Relative to Reference Period" length=$100;
STUDYID='test';DOMAIN='test';USUBJID='test';CESEQ=1;CEGRPID='test';CEREFID='test';CESPID='test';CETERM='test';CEDECOD='test';CECAT='test';CESCAT='test';CEOCCUR='Y';CESTRF='invalid';
output;
STUDYID='test';DOMAIN='test';USUBJID='test';CESEQ=1;CEGRPID='test';CEREFID='test';CESPID='test';CETERM='test';CEDECOD='test';CECAT='test';CESCAT='test';CEOCCUR='N';CESTRF='';
output;
STUDYID='test';DOMAIN='test';USUBJID='test';CESEQ=1;CEGRPID='test';CEREFID='test';CESPID='test';CETERM='test';CEDECOD='test';CECAT='test';CESCAT='test';CEOCCUR='N';CESTRF='AFTER';
output;
STUDYID='test';DOMAIN='test';USUBJID='test';CESEQ=1;CEGRPID='test';CEREFID='test';CESPID='test';CETERM='test';CEDECOD='test';CECAT='test';CESCAT='test';CEOCCUR='Y';CESTRF='DURING';
output;
STUDYID='test';DOMAIN='test';USUBJID='test';CESEQ=1;CEGRPID='test';CEREFID='test';CESPID='test';CETERM='test';CEDECOD='test';CECAT='test';CESCAT='test';CEOCCUR='';CESTRF='BEFORE';
output;
run;
%cdisc(datlib=templib,datname=ce);
