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

I want my y2 axis to start at 0 (which I try to achieve by putting in min=0) but it is not working (see graph below). Here is my code

 

proc sgplot data=tariffprem_pol7 ;

vbarparm category=period response=count / group=Business ;

series x=period y=aptp / group=Business lineattrs=(thickness=3) y2axis ;

y2axis min=0 offsetmin=0;

yaxis min=0 offsetmin=0;

yaxis label = "Policy Count";

y2axis label = "AP/TP";

xaxis label = "Month (2015 Year)";

run;

 

Capture.GIF

 

Any ideas where I'm going wrong?

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

Hi @brophymj,

 

I think, the reason is that you have two Y2AXIS statements. The options of the second one will override those of the first. So, please add the option label= "AP/TP" to the first Y2AXIS statement and delete the second Y2AXIS statement (and fix the similar issue with the two YAXIS statements).

View solution in original post

5 REPLIES 5
Reeza
Super User

Try specifying values explicitly instead?

FreelanceReinh
Jade | Level 19

The documentation of the Y2AXIS statement says: "[The MIN=] option does not determine the minimum axis tick value displayed. The THRESHOLDMIN= value is used to determine the minimum tick value." But the VALUES= option, which Reeza alluded to, gives you more control over the values displayed. Depending on your data, VALUES=(0 to 80 by 10) or VALUES=(0 to 0.8 by 0.1) should work.

brophymj
Quartz | Level 8

Hi

 

I tried putting in the values but it didn't work. here is  my code:

 

ods graphics / reset width=5in height=3in imagename='ROI Fleet APTP for 2015';

Title "ROI Fleet Earned APTP for 2015 (Split NB & Ren)";

proc sgplot data=tariffprem_pol7 ;

vbarparm category=period response=count / group=Business ;

series x=period y=aptp / group=Business lineattrs=(thickness=3) y2axis ;

y2axis min=0 values=(0 to 0.8 by 0.1) offsetmin=0;

yaxis min=0 offsetmin=0;

yaxis label = "Policy Count";

y2axis label = "AP/TP";

xaxis label = "Month (2015 Year)";

run;

FreelanceReinh
Jade | Level 19

Hi @brophymj,

 

I think, the reason is that you have two Y2AXIS statements. The options of the second one will override those of the first. So, please add the option label= "AP/TP" to the first Y2AXIS statement and delete the second Y2AXIS statement (and fix the similar issue with the two YAXIS statements).

brophymj
Quartz | Level 8
Thanks, that worked

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 5 replies
  • 3521 views
  • 0 likes
  • 3 in conversation