Hi,
I think the problem is that your plot has a linear axis rather than a time axis. To fix it, make sure randdt1 randdt2 addt1 addt2 all have date formats attached to them in work.final (you could add a format statement inside the SGPLOT). This should trigger SGPLOT to use a time axis.
One warning sign in your picture is that the month names are not the start of a quarter (they should be Jan, Apr, Jul, Oct). The easiest way to confirm this problem is to change the xaxis to valuesformat=date9. It should show you that the day values for each month are not the first or the last of the month, because it's a linear axis I think the start point is driven by the data. I'm surprised that SGPLOT doesn't throw at least a NOTE to say that you are using a time interval for a linear axis. I thought you could fix this by adding type=time to the axis statement, but SAS then throws a note that although you have requested a time axis, the axis will be changed to linear because the values being plotted are not time values.
So in order to get a proper time axis, it looks like the values need to be formatted as dates (or date-times or times) so SGPLOT knows it is plotting time values. Then SGPLOT will give you a time axis rather than a linear axis.
Sample code below. It's always helpful to make a tiny test case when exploring SAS questions, so that you can narrow down the problem.
data have ;
do randdt1="01Jan2020"d to "01Jan2021"d by 10 ;
randdt2=randdt1+100 ;
N++1 ;
output ;
end ;
run ;
title1 "This plot has a linear axis rather than a time axis because the variables are not formatted as dates" ;
proc sgplot data=have ;
highlow y=N low=randdt1 high=randdt2;
refline "11Mar2020"d /axis=x ;
xaxis interval=quarter valuesformat=mmddyy10. ;
run ;
title1 ;
title1 "This plot has a time axis because randdt1 and randdt2 have a date format attached" ;
proc sgplot data=have ;
highlow y=N low=randdt1 high=randdt2;
refline "11Mar2020"d /axis=x ;
xaxis interval=quarter valuesformat=mmddyy10. ;
format randdt1 randdt2 date9. ;
run ;
title1 ;
title1 "This plot has a time axis because randdt1 and randdt2 have a date format attached" ;
proc sgplot data=have ;
highlow y=N low=randdt1 high=randdt2;
refline "11Mar2020"d /axis=x ;
xaxis interval=quarter valuesformat=monyy7. ;
format randdt1 randdt2 date9. ;
run ;
title1 ;
... View more