BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
scmeyer
Calcite | Level 5

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;


CumulHplot.png
1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

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. 

View solution in original post

6 REPLIES 6
Reeza
Super User

Try using MONNAME3 format to show just the month?

scmeyer
Calcite | Level 5

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.

PGStats
Opal | Level 21

Use

 

xaxis label='Date' max = '01DEC2000'd valuesformat=mmddyy4.;

to override the automatic date format.

PG
scmeyer
Calcite | Level 5

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;

DanH_sas
SAS Super FREQ

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. 

scmeyer
Calcite | Level 5

Perfect, thanks! I don't know why I didn't see that sooner.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 6 replies
  • 13980 views
  • 2 likes
  • 4 in conversation