/*------------------------------------------------------------*
* program:     cdisc46.sas                                    *
* Description: Case #46. End Reerence Period For All (Timing) variables, *
*              this identifies records that violate the condition *
*              [End Relative to Reference Period is not null], *
*              limited to records where [End Date/Time of Observation is 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 CEENDTC	label="End Date/Time of Clinical Event" length=$12;
attrib CEENRF	label="End Relative to Reference Period" length=$20;

STUDYID='test';DOMAIN='test';USUBJID='test';CESEQ=1;CEGRPID='test';CEREFID='test';CESPID='test';CETERM='test';CEDECOD='test';CECAT='test';CESCAT='test';CEOCCUR='Y';
CEENDTC='2006-01-01';CEENRF='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='N';
CEENDTC='2006-01-01';CEENRF='';
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';
CEENDTC='2006-01-01';CEENRF='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='Y';
CEENDTC='';CEENRF='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='';
CEENDTC='';CEENRF='';
output;
run;
%cdisc(datlib=templib,datname=ce);
