BookmarkSubscribeRSS Feed
DavidJ
Calcite | Level 5
Currently, I have some graphs that manually label the Y-Axis using annotate to position the label left justified, starting directly above the Y-Axis line and continuing above the frame of the graph. I have tried to convert this using LABEL= on an AXIS statement, but SAS is always placing the label to the far left, above the Y-Axis values.
7 REPLIES 7
Bill
Quartz | Level 8
Please include some code in your posting. We need to see what you are doing.
DavidJ
Calcite | Level 5
The current code has the following in a data step:
**** y label;
xsys='1';
ysys='1';
hsys='3';
x=0;
y=100;
text=Y-Axis label';
style="&hwfont1";
size=&stdsize*&sizeadj; * Different sizes for different outputs;
color="&black.";
position='3';
output;
Bill
Quartz | Level 8
More code needed! What are you doing in the gplot routine that might be interfering with the annotate step?
DavidJ
Calcite | Level 5
More code supplied (with certain names made generic)
proc gplot data=name anno=anno gout=ris.&gseg;
plot mutual*n
stock*n /
vaxis=axis1
haxis=axis2
frame
legend=legend1
vref=0
lvref=34
name='name'
overlay
des=DESC';

format mutual stock comma4.;

* I have tried using label= with values w/ no luck;
axis1 origin=(&xorg.,&yorg.)
value=(h=&htextsize. f=&hwfont1. c=&black.)
label=none
order=(&low. to &high. by &increm.)
major=(h=-0.9 c=&black.)
minor=none length=&ylength.;

axis2 label=none
value=none
major=none
minor=none
length=&xlength.
order=(1 to &lastn. by 1)
offset=(2.5,2.5)pct;

symbol1 c=&rblack. i=join v=none l=&line1. w=&linewide.;
symbol2 c=&bblack. i=join v=none l=&line2. w=&linewide.;
legend1 across=1 down=2
offset=(-1,-1)
mode=share
label=none
position=(top right inside)
value=(font=&hwfont1. justify=l h=&ltextsize.
tick=1 'item 1'
tick=2 'item 2') ;
run;
quit;
DavidJ
Calcite | Level 5
Bill - I am trying to get away from a lot of old SAS/Graph code that relies too much on annotation for a lot of things (including tick marks, axis values and so on). Some of the code goes way back (15 years+). Most I can convert with no problems, the y-axis label positioning has me stumped.

Thanks
Bill
Quartz | Level 8
David;

I don't see how to move the label to where you I think you want it. But I fooled the title into the correct location. Try it without the move(1,93)pct. I think it's right where you want it.

data test;
input x y;
datalines;
1 4
2 3
3 6
4 9
5 7
6 1
7 7
8 5
9 2
;
run;

goptions reset=all
dev=win;


title1 '"Right" justifying the Y axis label';
title3 j=l move=(1,93) pct 'Long Axis Label'; *move is optional;

axis1 label=none;
axis2 label=none;
symbol1 i=join l=1 c='cxd7301f';
proc gplot data=test;
plot y*x/vaxis=axis1
haxis=axis2
;
run;
quit;
DavidJ
Calcite | Level 5
I like that trick. Maybe I will ask for an additional option as an enhancement on the label portion of the axis statement, something like location=inside to do what I want.

Thanks.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 2067 views
  • 0 likes
  • 2 in conversation