Data visualization with SAS programming

Band Statements in SGPANEL

Reply
Contributor
Posts: 22

Band Statements in SGPANEL

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;

Respected Advisor
Posts: 4,606

Re: Band Statements in SGPANEL

You should try with :

COLAXIS DISPLAY = (NOLABEL) TYPE=TIME TICKVALUEFORMAT=DATE9.;

PG

PG
Contributor
Posts: 22

Re: Band Statements in SGPANEL

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.

Respected Advisor
Posts: 4,606

Re: Band Statements in SGPANEL

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

PG
Ask a Question
Discussion stats
  • 3 replies
  • 395 views
  • 3 likes
  • 2 in conversation