I'm overlaying cumulative distributions from multiple years in one plot, plotting the cumulative percentage by date. I had to convert all dates to the same year to get them to all plot on the same xaxis. The xaxis tick marks are months, but SAS insists on showing the year on this axis. The date values are formatted as 'MMDDYY4.' but SAS overrides the formats and uses auto date formats.
Is there any way to format the x axis to display only the month?
Code:
proc sgplot data=CumulH;
series x=dummydate y=cum_pct/group = year;
xaxis label='Date' max = '01DEC2000'd;
run;
Since you have SAS 9.3, use TICKVALUEFORMAT instead of VALUESFORMAT. VALUESFORMAT is correct name of the option for SAS 9.4 and beyond, but TICKVALUEFORMAT will continue to work.
Try using MONNAME3 format to show just the month?
Thanks, tried formatting dummydate as MONNAME3., and even though the data appear in that format in the data file the plot still ignores it.
The log shows:
NOTE: The column format MONNAME3 is replaced by an auto-generated format on the axis.
I should have mentioned in the original post that I am using SAS 9.3 TS 1M0.
Use
xaxis label='Date' max = '01DEC2000'd valuesformat=mmddyy4.;
to override the automatic date format.
Thanks, interesting idea. I was looking for a way to override the default format. I should have mentioned in the original post that I'm using SAS 9.3. The valuesformat option is not listed for the xaxis statement in the SAS 9.3 ODS Graphics Procedures Guide (Second Edition). Is that available in SAS 9.4? I tried it anyway, and this was the log response:
627 xaxis label='Date' max = '01DEC2000'd valuesformat=mmddyy4.;
------------ --------
1 79
76
WARNING 1-322: Assuming the symbol VALUES was misspelled as valuesformat.
ERROR 79-322: Expecting a (.
ERROR 76-322: Syntax error, statement will be ignored.
628 run;
Since you have SAS 9.3, use TICKVALUEFORMAT instead of VALUESFORMAT. VALUESFORMAT is correct name of the option for SAS 9.4 and beyond, but TICKVALUEFORMAT will continue to work.
Perfect, thanks! I don't know why I didn't see that sooner.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.