The following log message appears when I run the macro below.
NOTE: Time axis can only support date time values. The axis type will be changed to LINEAR.
NOTE: The column format DATE9 is replaced by an auto-generated format on the axis.
Although the bands display as I want them to, the BAND statement is forcing my X AXIS to be converted to LINEAR even though it is initially formatted as a DATE9.
This creates some formatting issues for me. When I remove the BAND statements, I don't have this issue. Any thoughts on how to prevent this forced conversion would be appreciated.
%MACRO PLOT_SINGLE_SERIES_PANELBY(PANELBY = , IMAGENAME = , DATASET = , VARIABLE = , CHARTTITLE = , FOOTNOTE = , WHERE = );
ODS GRAPHICS ON / RESET=ALL IMAGENAME = "&IMAGENAME." NOBORDER BORDER=OFF;
GOPTIONS RESET = (TITLE FOOTNOTE);
TITLE1 "&CHARTTITLE.";
FOOTNOTE JUSTIFY =RIGHT HEIGHT = .8 "&FOOTNOTE.";
PROC SGPANEL DATA=&DATASET.
(WHERE = (&WHERE.)) NOAUTOLEGEND;
/* format sasdate YYQ4.;*/
PANELBY &PANELBY. / LAYOUT = ROWLATTICE NOVARNAME ROWHEADERPOS = RIGHT ONEPANEL;
BAND Y= &VARIABLE. UPPER = '30JUN2009'D LOWER = '31DEC2007'D;
BAND Y= &VARIABLE. UPPER = '31MAR2001'D LOWER = '30NOV2001'D;
SERIES X = SASDATE Y = &VARIABLE. / MARKERS LINEATTRS=(COLOR=RED);
ROWAXIS DISPLAY = (NOLABEL);
COLAXIS DISPLAY = (NOLABEL) TYPE=TIME;
RUN;
GOPTIONS RESET = (TITLE FOOTNOTE);
%MEND PLOT_SINGLE_SERIES_PANELBY;
You should try with :
COLAXIS DISPLAY = (NOLABEL) TYPE=TIME TICKVALUEFORMAT=DATE9.;
PG
Thanks PGStats. That does allow me to format the axis, although I still get the message in the log window that the axis is converted to linear.
Maybe you could try using variables instead of constants for the bands :
data _&DATASET. / view=_&DATASET.;
set &DATASET. (WHERE = (&WHERE.));
format UPPER1 UPPER2 LOWER1 LOWER2 date9.;
UPPER1 = '30JUN2009'D;
LOWER1 = '31DEC2007'D;
UPPER2 = '31MAR2001'D;
LOWER2 = '30NOV2001'D;
run;
PROC SGPANEL DATA=_&DATASET. NOAUTOLEGEND;
...
BAND Y= &VARIABLE. UPPER = UPPER1 LOWER = LOWER1;
BAND Y= &VARIABLE. UPPER = UPPER2 LOWER = LOWER2;
...
PG
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.