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

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
  • 5 replies
  • 2598 views
  • 0 likes
  • 3 in conversation