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

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

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