Hello, I have defeind the refline for specific date but it was coming before the date rather than specified. Below is my output, the refline date is 11MAR2020 , but it was displaye before Mar2020. Below is my code. data prefinal;
set indata;
if fasfl='Y';
cutoff=cov19pdt;
adt = FUPEDT;
if randdt > cutoff then do;
adt2=adt;
randdt2=randdt;
before='Y';
end;
else if adt < cutoff then do;
adt1=adt;
randdt1=randdt;
after='Y';
end;
else do;
randdt1=randdt;
adt1=cutoff;
randdt2=cutoff;
adt2=adt;
both='Y';
end;
format randdt randdt1 adt randdt2 adt2 cutoff date9. ;
keep usubjid randdt1 adt1 randdt2 adt2 cutoff randdt adt fupedt;
run;
proc sql noprint ;
create table xaxisdt as
select min(randdt) as xstdt format date9.
,max(adt) as xendt format date9.
,max(cutoff) as cutoffdt format date9.
from prefinal;
quit;
data xaxisdt;
set xaxisdt;
stdtn=intnx('month',xstdt,-1,'s');
stdtc=put(stdtn,date9.);
endtn=intnx('month',xendt,1,'s');
endtc=put(endtn,date9.);
keep stdtc endtc cutoffdt;
run;
proc sql noprint;
select stdtc,endtc ,cutoffdt into: xstdt, :xendt, :cutoffdt
from xaxisdt;
quit;
proc sgplot data=final;
highlow Y=N low=RANDDT1 high=ADT1/lineattrs=(thickness=1.5 pattern=solid color=grey) name='C' legendlabel='Follow-up Days';
highlow Y=N low=RANDDT2 high=ADT2/lineattrs=(thickness=1.5 pattern=solid color=charcoal) name='C' legendlabel='Follow-up Days';
yaxis label="Subjects (N = %trim(&n99))" values=(0 1000 2000 3000 4000 5000 6000 6500);
xaxis label="Study Calendar" interval=quarter VALUESFORMAT=MONYY7.;
refline "&cutoffdt."d/ axis=x lineattrs=(thickness=3 pattern=dash color=black) label="&cutoffdt. (COVID-19 Pandemic Date)";
inset "%trim(&nbe)% Of follow-up days prior to the start of COVID-19 pandemic" / position=left textattrs=(color=black size=9);
inset "%trim(&ndu)% Of follow-up days after or on the start of COVID-19 pandemic" / position=right textattrs=(color=black size=9);
run; Also please let me know how we can wrap inset text. Thank you, Rajasekahar B
... View more