BookmarkSubscribeRSS Feed
emikea
Calcite | Level 5

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;

3 REPLIES 3
PGStats
Opal | Level 21

You should try with :

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

PG

PG
emikea
Calcite | Level 5

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.

PGStats
Opal | Level 21

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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1223 views
  • 3 likes
  • 2 in conversation