Help using Base SAS procedures

axis statement order by quarter?

Reply
Regular Contributor
Regular Contributor
Posts: 156

axis statement order by quarter?

Dear all,

I have a prog gplot and on the haxis I want to display quarters of a year. On this axis I would like to have only the tick marks of the quarters, nothing else.

I tried haxis=axis1;

axis1 order=(200804 to 200902 by quarter);

And as I have a look in the data I have 200804, 200901, 200902.

But all I get is the tick mark 200902 and the hint that all other values are outside the axis range:
8 observation(s) outside the axis range

What's wrong here? Does the "by quarter" exist in sas?

Best regards
Eva
N/A
Posts: 0

Re: axis statement order by quarter?

This isn't a direct answer to your question, but you can find examples of graphs that use the tick mark at http://support.sas.com/sassamples/graphgallery/PROC_GPLOT_Graph_Elements_Axis.html. Scroll through and choose the image closest to what you need. Then select the View Code link just above the image.
Super Contributor
Posts: 291

Re: axis statement order by quarter?

indeed there is

axis1 order=("&strtyr"d to "&Grfend"d by qtr);
Regular Contributor
Regular Contributor
Posts: 156

Re: axis statement order by quarter?

Dear Bill,

I habe the quarters in the format 200804 (yyyyqq). So the "&myqtr"d doesn't work. Unfortunately q instead of d doesn't work either ;-)

Best regards
Eva
Super Contributor
Super Contributor
Posts: 3,174

Re: axis statement order by quarter?

Assign another SAS numeric variable and convert the character-format date string into another SAS variable using the INPUT function with the appropriate INFORMAT. Another option is to generate a SAS macro variable with a discrete list of values using PROC SQL.

Scott Barry
SBBWorks,Inc.
Regular Contributor
Regular Contributor
Posts: 156

Re: axis statement order by quarter?

Dear Scott Barry,

that's exactly how I solved it in the meantime. Another solution is to just change the graph. I though about doing a proc gchart where I can define midpoints. As they are quarters that's easy, because they don't need too much space.

Best regards
Eva
Super Contributor
Posts: 291

Re: axis statement order by quarter?

Eva;

The axis statement that I posted earlier (sorry that it was so terse) pre-supposes that the dates will be SAS date values (i.e. days since 01Jan1960).

To force quarters to be the first day of the quarter, I often use the intnx function as follows:

QtrDate=intnx("Quarter',ActualDateValue,0,'b'); This results in values like 01JanYY, 01AprYY,01JulYY,01OctYY when formatted as date5. This date field will then plot very nicely with a qtr increment in the axis statement.

Hope this helps,
Bill
Regular Contributor
Regular Contributor
Posts: 156

Re: axis statement order by quarter?

Dear Bill,

great idea - and it works well! Thanx for the advice!

Best wishes
Eva
Ask a Question
Discussion stats
  • 7 replies
  • 90 views
  • 0 likes
  • 4 in conversation