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;
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
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
Thank you. Explicitly naming the tick mark values did the trick.
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.
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.