BookmarkSubscribeRSS Feed
Eva
Quartz | Level 8 Eva
Quartz | Level 8
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
7 REPLIES 7
deleted_user
Not applicable
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.
Bill
Quartz | Level 8
indeed there is

axis1 order=("&strtyr"d to "&Grfend"d by qtr);
Eva
Quartz | Level 8 Eva
Quartz | Level 8
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
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
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.
Eva
Quartz | Level 8 Eva
Quartz | Level 8
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
Bill
Quartz | Level 8
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
Eva
Quartz | Level 8 Eva
Quartz | Level 8
Dear Bill,

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

Best wishes
Eva

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 7 replies
  • 1554 views
  • 1 like
  • 4 in conversation