Dear All,
I set up yaxis scale as from 0.1 to 100 but it does not work (see dataset and code below). Could someone help me? I use SAS 9.2 (32). thanks!
data char;
input Date Rate1 RL Rate2 RU;
datalines;
0 . . . .
2 2.5 3.65 2.552 1.482
4 2.444 3.811 2.28 1.118
8 2.60 4.185 2.545 1.039
12 2.385 3.492 2.737 1.316
16 2.454 3.957 2.395 1.182
24 2.524 3.857 2.755 1.515
;
proc sgplot data=char;
xaxis label='Date' values=(0 to 24 by 4) ;
yaxis label="Rate" values=(0.1 to 100 by 10) type=log logbase=10 logstyle=logexpand minor ;
series x=Date y=Rate2 / lineattrs=(pattern=solid color=black thickness=1.5)
markers markerattrs =(size=9 color=black symbol=circle)
legendlabel='Rate2' name='Sbar';
scatter x=Date y=Rate2 / yerrorupper=RU markerattrs =(size=9 color=black symbol=circle) ;
series x=Date y=Rate1 / lineattrs=(pattern=dash color=black thickness=1.5)
markers markerattrs =(size=9 color=black symbol=x)
legendlabel='Rate1' name='Ebar';
scatter x=Date y=Rate1 / yerrorlower=RL markerattrs =(size=9 color=black symbol=x) ;
keylegend "Sbar" "Ebar"/position=topright location=inside across=1;
run;
You're going to get the lob value not the value you specify in the axis statement.
What exactly do you want that axis to look like? "Doesn't work" is kind of hard to interpret without details.
Dear Ballardw,
I want the y-axis scale to be from 0.1 to 100. how to do that? thanks! John
after I set the "values=(0.1 to 100 by 10)", the scale still showed from 1 to 10, not from 0.1 to 100 as I wanted
I'm curious about what you think displaying 100 means in context of a logarithmic axis when your data example has a max value less than 5.
If you are using SAS 9.3 or later, the following YAXIS code may work better for you:
yaxis label="Rate" values=(0.1 1 10 50 100) min=0.1 max=100 type=log logbase=10 logstyle=logexpand minor ;
Sanjay,
it works at SAS 9.4.
Thanks!!!
John
the reason to set up from 0.1 to 100 is to compare with other figures that have the same scale
If you succeed in getting that label your displayed graph is going to be pretty unreadable unless you make it like 15 or 20 inches in the vertical dimension since you data only goes to 5 it will only use 5% of the graph vertical space.
Hi,
Not sure, how type=log works in the above code? log for values < 1 will generate negative values.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.