Below is the code, not sure whats the issue the proc gplot output is showing twice. Also, another question - how to suppress the directory and dataset contents table in the output pdf file. *raw data path;
libname seretide "C:/xxxx" INENCODING=ASCIIANY;
*transformed data path;
libname strans "C:/xxxx" INENCODING=ASCIIANY;
proc datasets library=work nodetails kill;
/* modify have/ correctencoding='utf8'; */
quit;
ods listing close;
ods pdf file="C:\Users\User\0001.pdf" startpage=no;
proc sort data=seretide.en out=entable
(drop = subjectstatus visit form formentrydate subjectvisitformid);
by subjectid;
run;
proc sort data = seretide.dm out=dmtable
(drop = subjectstatus visit form formentrydate subjectvisitformid);
by subjectid;
run;
proc sort data=seretide.cm out = cmtable
(drop = subjectstatus visit form formentrydate subjectvisitformid);
by subjectid;
run;
proc sql noprint;
create table work.en_dm_cm as
select entable.*, dmtable.*, cmtable.*
from work.entable (where = (subjectid = '0001'))
left join work.dmtable (where = (subjectid = '0001'))
on entable.subjectid = dmtable.subjectid
left join work.cmtable (where = (subjectid = '0001'))
on entable.subjectid = dmtable.subjectid;
quit;
data patdemo;
set en_dm_cm;
where subjectid = '0001';
label SCRID = 'Screening Number'
SUBJINIT = 'Subject Initials'
BRTHDTC = 'Date of Birth'
AGE = 'Age (In Years)'
RACE = 'Race';
if _n_ = 1;
run;
proc print data=patdemo noobs label;
Variables SCRID SUBJINIT SUBJID BRTHDTC AGE SEX ETHNIC RACE;
Title 'Patient Information for 0001';
run;
proc sort data=seretide.ae out=aetable;
by subjectid;
run;
data aetab (Keep= SUBJECTID AEYN AESEV AESTDAT AEENDAT AEACN AEOUT);
set work.aetable;
where subjectid = "0001";
Label AEYN = 'Adverse Event Yes/No'
AESEV = 'Adverse Event Severity'
AESTDAT = 'Adverse Event Start Date'
AEENDAT = 'Adverse Event End Date'
AEACN = 'Action Taken'
AEOUT = 'Outcome';
run;
Proc print data=aetab noobs label;
Title "No Adverse Events Reported for Patient ID: 0001";
run;
data cmtab;
set work.en_dm_cm
(keep = subjectid CMYN CMTRT CMTRT_PREFERRED CMTRT_DRUGNAME
CMINDC CMSTDAT CMENDAT CMDOSTXT CMDOSU CMDOSUSP CMDOSFRQ
CMFREQSP CMROUTE CMROUTSP );
where subjectid = '0001' and CMYN eq ' ';
select;
when (CMDOSU = 'Other') CMDOSU = '(mcg)';
when (CMDOSU = 'Milligram') CMDOSU = '(Mg)';
when (CMDOSU = 'Puff') CMDOSU = '(pf)';
Otherwise CMDOSU = '(IU)';
end;
if CMDOSFRQ = 'Other' then CMDOSFRQ = CMFREQSP;
if CMDOSFRQ ne ' ' then
DDWF = Strip(CMTRT) || ' ' || strip(CMDOSTXT) || ' ' || strip(CMDOSU) || ' ' || '(' || strip(CMDOSFRQ) || ')';
else DDWF = Strip(CMTRT) || ' ' || strip(CMDOSTXT) || strip(CMDOSU);
Label DDWF = 'Drug Dosage with Frequency';
Drop SUBJECTID CMYN CMTRT CMTRT_PREFERRED CMTRT_DRUGNAME CMDOSTXT CMDOSU
CMDOSUSP CMDOSFRQ CMFREQSP CMROUTSP;
run;
proc print data=cmtab noobs label;
Title 'Concomitant Medication history for Patient ID 0001';
run;
proc sort data=seretide.vs out=vstable;
by subjectid;
run;
data vstab;
set vstable (keep = SUBJECTID VISIT VSPERF VSDAT VSPOS VSTEST VSORRES
VSORRESU VSTEST1 VSORRES1 VSORRESU1);
where subjectid = '0001';
select;
when (VSORRESU = 'CM') VSORRESU = '(cm)';
when (VSORRESU = 'Kg') VSORRESU = '(kg)';
when (VSORRESU = 'Degree Fahrenheit') VSORRESU = '(°F)';
when (VSORRESU = 'Beats per Minute') VSORRESU = '(bpm)';
when (VSORRESU = 'Breaths per Minute') VSORRESU = '(brpm)';
when (VSORRESU = 'mm Hg') VSORRESU = '(mm Hg)';
when (VSTEST = 'Height') VSORRESU = '(cm)';
otherwise VSORRESU = ' ';
end;
select;
when (VSORRESU1 = 'CM') VSORRESU1 = '(cm)';
when (VSORRESU1 = 'Kg') VSORRESU1 = '(kg)';
when (VSORRESU1 = 'Degree Fahrenheit') VSORRESU1 = '(°F)';
when (VSORRESU1 = 'Beats per Minute') VSORRESU1 = '(bpm)';
when (VSORRESU1 = 'Breaths per Minute') VSORRESU1 = '(brpm)';
when (VSORRESU1 = 'mm Hg') VSORRESU1 = '(mm Hg)';
otherwise VSORRESU1 = ' ';
end;
if Visit = ('Randomization (Visit 2/Day 0)') or
Visit = ('End of Treatment/Early termination (Visit 3)') then do;
VSTEST = VSTEST1;
VSORRES = VSORRES1;
VSORRESU = VSORRESU1;
end;
retain _vsdat _vspos;
if not missing(vsdat) then _vsdat = vsdat;
else vsdat = _vsdat;
if not missing(vspos) then _vspos = vspos;
else vspos = _vspos;
if vsperf = 'Yes' then delete;
drop _vsdat _vspos VSPERF VSTEST1 VSORRES1 VSORRESU1 ;
run;
Proc sort data=vstab (where=(vstest ne 'Height')) out=vstab;
by vstest vsdat;
run;
data vsdia vssys vstemp vswt vshr vsresp;
set vstab;
if vstest = 'Diastolic Blood Pressure' then output vsdia;
if vstest = 'Systolic Blood Pressure' then output vssys;
if vstest = 'Temperature' then output vstemp;
if vstest = 'Weight' then output vswt;
if vstest = 'Heart Rate' then output vsresp;
run;
Title 'Vital Stats Diastolic Blood Pressure for Patient ID: 0001';
PROC GPLOT DATA = vsdia;
SYMBOL1 INTERPOL=JOIN HEIGHT=10pt VALUE=NONE LINE=1 WIDTH=2 CV = _STYLE_;
Axis1 STYLE=1 WIDTH=1 MINOR=NONE label = ('(Hg mm)');
Axis2 STYLE=1 WIDTH=1 MINOR=NONE;
PLOT VSORRES * VSDAT /
VAXIS=AXIS1
HAXIS=AXIS2
FRAME;
BY VSTEST;
RUN;
ods pdf close;
ods listing;
... View more