Desktop productivity for business analysts and programmers

Graph axis style question

Reply
Contributor
Posts: 35

Graph axis style question

I have line graphs with date labels along the horizontal axis. In EG, the labels are staggered horizontally, but I can manually adjust the labels to have either a vertical or angled layout. Is there a way I can write the SAS code to make the graphs automatically have a vertical layout?

Turnhlabels is the only line of code I have found, but I can't make it work with proc gcharts.
SAS Super FREQ
Posts: 8,721

Re: Graph axis style question

Hi,
The AXIS statement will allow you to change the rotation of the label (like 'DATE') or the rotation of the variable values (like '01JAN06' or '01FEB06').
The syntax on the axis statement is very straightforward, and you can select it in the EG task window. The syntax will be something like:
[pre]
AXIS1 minor=none label=(angle=45) value=(angle=45);

[/pre] but then you have to link the AXIS statement with the SAS/Graph procedure. So, for example, if your procedure of choice is PROC GPLOT, then you would issue a PLOT statement like this:
[pre]PLOT YVAR*XVAR/ HAXIS=AXIS1; [/pre]
Basically, it's the same thing with PROC GCHART, only you would have something like:[pre]
vbar3d chartvar / maxis=axis1; [/pre]
specified for the horizontal axis or midpoint axis.

However, there is not a good way to set this as the default all the time, because you might want to use a different AXIS statement with different SAS/Graph procedures.

When you are in EG, look under the Horizontal Axis choice in the navigation panel. When you are working with the Horizontal axis, you will find a tab for the Label and a tab to change the Value. You can change the label rotation on the Label tab and the value rotation on the value tab. This should put the correct code into your EG project.
Hope this helps,
cynthia
Contributor
Posts: 35

Re: Graph axis style question

Thank you. The code works perfectly.

But I still can't find this option in EG3 for scatter plots.
SAS Super FREQ
Posts: 8,721

Re: Graph axis style question

Sorry, I only have EG4 to test with. When I do a Scatter Plot in EG4 and select the click path:
Graph --> Scatter Plot

and then after selecting Task Roles for my data (to put my date on the horizontal axis), I can select:
Horizontal Axis --> Label TAB --> Label Rotation --> 45
(the Label Rotation choice is under the big white box for entering the Label value) and
Horizontal Axis --> Values TAB --> Value Rotation --> 45
(The Value Rotation choice is directly underneath the drop down box for selecting a Font for the Values)


You may have to contact Tech Support to find out how to do this in EG 3. I -thought- the rotation option was also available in the Task Window in EG3.
cynthia
Ask a Question
Discussion stats
  • 3 replies
  • 110 views
  • 0 likes
  • 2 in conversation