Data visualization with SAS programming

Yaxis scale

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 14
Accepted Solution

Yaxis scale

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;


Accepted Solutions
Solution
‎08-18-2014 12:10 PM
Occasional Contributor
Posts: 14

Re: Yaxis scale

Sanjay,

it works at SAS 9.4.

Thanks!!!

John

View solution in original post


All Replies
Grand Advisor
Posts: 9,686

Re: Yaxis scale

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.

Occasional Contributor
Posts: 14

Re: Yaxis scale

Dear Ballardw,

I want the y-axis scale to be from 0.1 to 100. how to do that?  thanks!  John

Occasional Contributor
Posts: 14

Re: Yaxis scale

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

Grand Advisor
Posts: 9,686

Re: Yaxis scale

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.

SAS Super FREQ
Posts: 1,040

Re: Yaxis scale

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  ;

Solution
‎08-18-2014 12:10 PM
Occasional Contributor
Posts: 14

Re: Yaxis scale

Sanjay,

it works at SAS 9.4.

Thanks!!!

John

Occasional Contributor
Posts: 14

Re: Yaxis scale

the reason to set up from 0.1 to 100 is to compare with other figures that have the same scale

Grand Advisor
Posts: 9,686

Re: Yaxis 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.

Trusted Advisor
Posts: 1,192

Re: Yaxis scale

Hi,

Not sure, how type=log works in the above code? log for values < 1 will generate negative values.

Post a Question
Discussion Stats
  • 9 replies
  • 508 views
  • 3 likes
  • 4 in conversation