/*------------------------------------------------------------* 
* program:     cdisc65.sas                                    * 
* Description: Case #65. Code List Found For All domains, this identifies records where *
*              values are not found in the study-specific codelist attached to a variable.* 
* By:          Sy Truong, 10/14/2009                          *
*-------------------------------------------------------------*/

libname templib '../data';

proc format library=work;
   value $chtoch 'F' = 'Female'
                  'M' = 'Male'
                  ;
run;

data templib.ae;
attrib STUDYID length=$7 label="Study Identifier";
attrib DOMAIN length=$2 label="Domain Abbreviation";
attrib USUBJID length=$14 label="Unique Subject Identifier";
attrib AESEQ length=8 label="Sequence Number";
attrib AETERM length=$25 label="Reported Term for the Adverse Event";
attrib AEMODIFY length=$9 label="Modified Reported Term";
attrib AEDECOD length=$18 label="Dictionary-Derived Term";
attrib AEBODSYS length=$52 label="Body System or Organ Class";
attrib AESEV length=$8 label="Severity/Intensity";
attrib AESER length=$1 label="Serious Event";
attrib AEACN length=$30 label="Action Taken with Study Treatment";
attrib AEREL length=$16 label="Causality";
attrib AECONTRT length=$1 label="Concomitant or Additional Trtmnt Given";
attrib AESTDTC length=$10 label="Start Date/Time of Adverse Event";
attrib AEENDTC length=$10 label="End Date/Time of Adverse Event";
attrib AESTDY length=8 label="Study Day of Start of Adverse Event";
attrib AEENDY length=8 label="Study Day of End of Adverse Event";
attrib AEENRF length=$5 label="End Relative to Reference Period";
attrib varcode length=$5 label="Variable has format code" format=$chtoch.;

STUDYID="CDISC01";
DOMAIN="AE";
USUBJID="CDISC01.100008";
AESEQ=1;
AETERM="AGITATED";
AEMODIFY="AGITATION";
AEDECOD="Agitation";
AEBODSYS="Psychiatric disorders";
AESEV="MILD";
AESER="N";
AEACN="DOSE NOT CHANGED";
AEREL="POSSIBLY RELATED";
AECONTRT="";
AESTDTC="2003-05";
AEENDTC="";
AESTDY=3;
AEENDY=.;
AEENRF="AFTER";
varcode='F';

output;
STUDYID="CDISC01";
DOMAIN="AE";
USUBJID="CDISC01.100008";
AESEQ=2;
AETERM="ANXIETY";
AEMODIFY="";
AEDECOD="Anxiety";
AEBODSYS="Psychiatric disorders";
AESEV="MODERATE";
AESER="N";
AEACN="DOSE NOT CHANGED";
AEREL="POSSIBLY RELATED";
AECONTRT="";
AESTDTC="2003-05-13";
AEENDTC="";
AESTDY=15;
AEENDY=.;
AEENRF="AFTER";
varcode='M';
output;
STUDYID="CDISC01";
DOMAIN="AE";
USUBJID="CDISC01.100008";
AESEQ=3;
AETERM="DECREASED APPETITE";
AEMODIFY="";
AEDECOD="Decreased appetite";
AEBODSYS="Metabolism and nutrition disorders";
AESEV="MILD";
AESER="N";
AEACN="DOSE NOT CHANGED";
AEREL="POSSIBLY RELATED";
AECONTRT="";
AESTDTC="2003-08-19";
AEENDTC="2003-09-15";
AESTDY=113;
AEENDY=140;
AEENRF="";
varcode="FM";
output;
STUDYID="CDISC01";
DOMAIN="AE";
USUBJID="CDISC01.100014";
AESEQ=1;
AETERM="DIARRHEA";
AEMODIFY="";
AEDECOD="Diarrhoea";
AEBODSYS="Gastrointestinal disorders";
AESEV="MILD";
AESER="N";
AEACN="DOSE NOT CHANGED";
AEREL="NOT RELATED";
AECONTRT="";
AESTDTC="2004-01-06";
AEENDTC="";
AESTDY=84;
AEENDY=.;
AEENRF="AFTER";
output;
run;
%cdisc(datlib=templib,datname=ae);
