/*------------------------------------------------------------*
* program:     cdisc73.sas                                    *
* Description: Case #73. Subject Visit For All domains, this identifies *
*              Unique Subject Identifier+Visit Name+Visit Number*
*              combinations not found in the SV domain.*
* 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=8;
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';
output;

STUDYID='123456';
DOMAIN='SV';
USUBJID='101';
VISITNUM=2;
VISIT='DAY 1';
output;

STUDYID='123456';
DOMAIN='SV';
USUBJID='101';
VISITNUM=2;
VISIT='WEEK 1';
output;

STUDYID='123456';
DOMAIN='SV';
USUBJID='101';
VISITNUM=4;
VISIT='WEEK 2';
output;

STUDYID='123456';
DOMAIN='SV';
USUBJID='101';
VISITNUM=4.1;
VISIT='';
output;

STUDYID='123456';
DOMAIN='SV';
USUBJID='101';
VISITNUM=8;
VISIT='FOLLOW-UP';
output;
run;

data templib.co(label="Comments");
 attrib STUDYID  	 label="Study Identifier" length=$100;
 attrib  DOMAIN  	 label="Domain Abbreviation" length=$100; 
 attrib  RDOMAIN  	 label="Related Domain Abbreviation" length=$100;
 attrib  USUBJID  	 label="Unique Subject Identifier" length=$100;
 attrib  COSEQ  	 label="Sequence Number" length=8;
 attrib  IDVAR  	 label="Identifying Variable" length=$100;
 attrib  IDVARVAL  	 label="Identifying Variable Value" length=$100; 
 attrib  COREF  	 label="Comment Reference" length=$100;
 attrib  COVAL  	 label="Comment" length=$100;
 attrib  COEVAL  	 label="Evaluator" length=$100;
 attrib  CODTC  	 label="Date/Time of Comment" length=$100;
 attrib VISITNUM	 label="Visit Number" length=8;
 attrib VISIT		 label="Visit Name" length=$100;
 STUDYID  ='test'; DOMAIN  ='test'; RDOMAIN  ='DV'; USUBJID  ='101'; COSEQ  =1; IDVAR  ='test'; IDVARVAL  ='test'; COREF  ='test'; COVAL  ='test'; COEVAL  ='test'; CODTC  ='test';
 VISITNUM=1;
 VISIT='SCREEN';
 output;
 STUDYID  ='test'; DOMAIN  ='test'; RDOMAIN  ='DS'; USUBJID  ='101'; COSEQ  =1; IDVAR  ='test'; IDVARVAL  ='test'; COREF  ='test'; COVAL  ='test'; COEVAL  ='test'; CODTC  ='test';
 VISITNUM=2;
 VISIT='DAY 1';
 output;
 STUDYID  ='test'; DOMAIN  ='test'; RDOMAIN  ='AE'; USUBJID  ='101'; COSEQ  =1; IDVAR  ='test'; IDVARVAL  ='test'; COREF  ='test'; COVAL  ='test'; COEVAL  ='test'; CODTC  ='test';
 VISITNUM=4;
 VISIT='WEEK 2';
 output;
 STUDYID  ='test'; DOMAIN  ='test'; RDOMAIN  ='LB'; USUBJID  ='102'; COSEQ  =1; IDVAR  ='test'; IDVARVAL  ='test'; COREF  ='test'; COVAL  ='test'; COEVAL  ='test'; CODTC  ='test';
 VISITNUM=4;
 VISIT='WEEK 2';
 output;
 STUDYID  ='test'; DOMAIN  ='test'; RDOMAIN  ='DM'; USUBJID  ='102'; COSEQ  =1; IDVAR  ='test'; IDVARVAL  ='test'; COREF  ='test'; COVAL  ='test'; COEVAL  ='test'; CODTC  ='test';
 VISITNUM=4;
 VISIT='WEEK 2';
 output;
 STUDYID  ='test'; DOMAIN  ='test'; RDOMAIN  ='SE'; USUBJID  ='102'; COSEQ  =1; IDVAR  ='test'; IDVARVAL  ='test'; COREF  ='test'; COVAL  ='test'; COEVAL  ='test'; CODTC  ='test';
 VISITNUM=4;
 VISIT='WEEK 2';
 output;
run;%cdisc(datlib=templib,datname=co);
