Data visualization with SAS programming

SGPLOT: Precisely Setting the X-Axis Values

Accepted Solution Solved
Reply
Contributor
Posts: 22
Accepted Solution

SGPLOT: Precisely Setting the X-Axis Values

Hello. I have a dataset which I'm plotting; however, I can't get my graph to label the x-axis so that both the beginning and ending data points are labeled on the x-axis. I'm using the following code. I've tried all kinds of different approaches but can't get the 3Q13 label to show on my x-axis. The chart is correctly plotting from 01Q1 to 13Q3, but the x-axis will only show 13Q1 as the last labeled item, which can be misleading to the viewer. Any suggestions? I've tinkered with the MAX option for the XAXIS statement, but without any luck.

Thanks in advance.

PROC SGPLOT DATA = work.temp

                     (where = (hcname = "&hcname." and SASDATE GE '31MAR2001'D))

                     NOAUTOLEGEND ;

              FORMAT SASDATE YYQ4.;

              SERIES X = SASDATE  Y = &VARIABLE. /  TRANSPARENCY=1;

                     BAND Y= &VARIABLE. UPPER = '31DEC2007'D LOWER = '30JUN2009'D;

                     BAND Y= &VARIABLE. UPPER = '31MAR2001'D LOWER = '30NOV2001'D;

              SERIES X = SASDATE  Y = &VARIABLE. / MARKERS CURVELABEL = "&CURVELABEL."

                           CURVELABELLOC = OUTSIDE DATALABEL =&VARIABLE. LINEATTRS=(Color=Red) CURVELABELATTRS=(Color=Red);

            

                     XAXIS TYPE=TIME   LABEL = " " FITPOLICY= THIN TICKVALUEFORMAT = YYQ4. VALUES=('31MAR2001'D TO '30SEP2013'D BY QUARTER );

                     YAXIS /* MIN = 0 MAX = 5 */ TYPE = LINEAR LABEL = "&YAXISLABEL.";

         

              RUN;


Accepted Solutions
Solution
‎12-03-2013 09:35 PM
Respected Advisor
Posts: 4,608

Re: SGPLOT: Precisely Setting the X-Axis Values

In the doc it says that the VALUES=() option works differently if you specify the values explicitly instead of via a range description  (a TO b BY c). So, try stating explicitly the full list of tick mark values that you want. Also remove the FITPOLICY=THIN option because that gives SAS the permission to remove some of the tick mark values.

PG

PG

View solution in original post


All Replies
Solution
‎12-03-2013 09:35 PM
Respected Advisor
Posts: 4,608

Re: SGPLOT: Precisely Setting the X-Axis Values

In the doc it says that the VALUES=() option works differently if you specify the values explicitly instead of via a range description  (a TO b BY c). So, try stating explicitly the full list of tick mark values that you want. Also remove the FITPOLICY=THIN option because that gives SAS the permission to remove some of the tick mark values.

PG

PG
Contributor
Posts: 22

Re: SGPLOT: Precisely Setting the X-Axis Values

Thank you. Explicitly naming the tick mark values did the trick.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 2833 views
  • 0 likes
  • 2 in conversation