/*------------------------------------------------------------*
* program:     cdisc30.sas                                     *
* Description: Case #30. Start End Records For all timing variables, *
*              this identifies records that violate the condition *
*              [(Start Date/Time of Observation less than or equal to End Date/Time of Observation)],*
*              limited to records where [Start Date/Time of Observation is not null and End Date/Time of Observation is not null].*
* By:          Sy Truong, 10/14/2009                          *
*-------------------------------------------------------------*/
 
libname templib '../data';

*** Create some data to be selected ***;
data templib.sv(label="Subject Visits");
attrib STUDYID	label="Study Identifier" length=$100;
attrib DOMAIN	label="Domain Abbreviation" length=$100;
attrib USUBJID	label="Unique Subject Identifier" length=$100;
attrib VISITNUM	label="Visit Number" length=8;
attrib VISIT	label="Visit Name" length=$100;
attrib VISITDY	label="Planned Study Day of Visit" length=$100;
attrib SVSTDTC	label="Start Date/Time of Visit" length=$100;
attrib SVENDTC	label="End Date/Time of Visit" length=$100;
attrib SVSTDY	label="Study Day of Start of Visit" length=8
attrib SVENDY	label="Study Day of End of Visit" length=8;
attrib SVUPDES	label="Description of Unplanned Visit" length=$100;
STUDYID= '123456';DOMAIN = 'SV';USUBJID	='101';VISITNUM =1;VISIT =	'SCREEN';VISITDY= -7;SVSTDTC	= '2006-01-15';SVENDTC	='2005-01-20';SVSTDY =-6;SVENDY = -1;SVUPDES	='';
output;

STUDYID= '123456';DOMAIN = 'SV';USUBJID	='101';VISITNUM =2;VISIT =	'DAY 1';VISITDY= 1;SVSTDTC	= '2006-01-21';SVENDTC	='2006-01-21';SVSTDY =1;SVENDY = 1;SVUPDES	='';
output;

STUDYID= '123456';DOMAIN = 'SV';USUBJID	='101';VISITNUM =3;VISIT =	'WEEK 1';VISITDY= 8;SVSTDTC	= '2006-01-27';SVENDTC	='2006-01-27';SVSTDY =7;SVENDY = 7;SVUPDES	='';
output;

STUDYID= '123456';DOMAIN = 'SV';USUBJID	='101';VISITNUM =4;VISIT =	'WEEK 2';VISITDY= 15;SVSTDTC	= '2006-02-04';SVENDTC	='2006-02-04';SVSTDY =15;SVENDY = 15;SVUPDES	='';
output;

STUDYID= '123456';DOMAIN = 'SV';USUBJID	='101';VISITNUM =8;VISIT =	'FOLLOW-UP';VISITDY= 71;SVSTDTC	= '2006-02-15';SVENDTC	='2006-02-15';SVSTDY =26;SVENDY = 26;SVUPDES	='';
output;
run;
%cdisc(datlib=templib,datname=sv);
