BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Johnlee
Calcite | Level 5

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;

1 ACCEPTED SOLUTION

Accepted Solutions
Johnlee
Calcite | Level 5

Sanjay,

it works at SAS 9.4.

Thanks!!!

John

View solution in original post

9 REPLIES 9
ballardw
Super User

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.

Johnlee
Calcite | Level 5

Dear Ballardw,

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

Johnlee
Calcite | Level 5

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

ballardw
Super User

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.

Jay54
Meteorite | Level 14

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  ;

Johnlee
Calcite | Level 5

Sanjay,

it works at SAS 9.4.

Thanks!!!

John

Johnlee
Calcite | Level 5

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

ballardw
Super User

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.

stat_sas
Ammonite | Level 13

Hi,

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

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
  • 9 replies
  • 1508 views
  • 3 likes
  • 4 in conversation