I am doing a plot, need set y2axis with y2ais=0, range [0, x)
The code does not complain. But the plot still without zero on y2axis. Anyone?!
proc sgplot data=_dif_temp_coll;
series x=endrange_n y=ind_min_dif / lineattrs=( color=blue thickness=2 pattern=solid);
series x=endrange_n y=ind_off25_min / y2axis lineattrs=( color=red thickness=2 pattern=solid);
refline &endind./axis=y lineattrs=(color=lime thickness=1 pattern=solid);
refline 0/axis=x lineattrs=(color=lime thickness=1 pattern=solid);
y2axis offsetmin=0;
run;quit;
8436 proc sgplot data=_dif_temp_coll;
8437 series x=endrange_n y=ind_min_dif / lineattrs=( color=blue thickness=2 pattern=solid);
8438 series x=endrange_n y=ind_off25_min / y2axis lineattrs=( color=red thickness=2 pattern=solid);
8439 refline &endind./axis=y lineattrs=(color=lime thickness=1 pattern=solid);
8440 refline 0/axis=x lineattrs=(color=lime thickness=1 pattern=solid);
8441 y2axis offsetmin=0;
8442 run;
8442! quit;
NOTE: PROCEDURE SGPLOT used (Total process time):
real time 0.25 seconds
cpu time 0.07 seconds
NOTE: There were 18 observations read from the data set WORK._DIF_TEMP_COLL.
If change the code as below, y2axis min=0; The plot shows up with y2axis=0. But the min of y2axis could be
any value. Surely SQL select into: can make it. But like to skip if possible.
proc sgplot data=_dif_temp_coll;
series x=endrange_n y=ind_min_dif / lineattrs=( color=blue thickness=2 pattern=solid);
series x=endrange_n y=ind_off25_min / y2axis lineattrs=( color=red thickness=2 pattern=solid);
refline &endind./axis=y lineattrs=(color=lime thickness=1 pattern=solid);
refline 0/axis=x lineattrs=(color=lime thickness=1 pattern=solid);
y2axis min=0;
run;quit;
If change the code as below, y2axis min=0; The plot shows up with y2axis=0. But the min of y2axis could be
any value.
Does this mean the min of y2axis could be negative? What if the min of y2axis is 75? Do you still want 0 to appear on the axis?
It helps if you explain clearly what you DO want, rather than stating it doesn't work in some situations. We need rules about what should appear in every situation, not examples of a few things that are wrong. Rules, not examples.
Ye, I need y2axis=0 is always there wether the range is [-5, 20] or [5, 20].
I think you need a macro variable which contains the minimum of the data. From there you can determine how to set MIN=
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.
Ready to level-up your skills? Choose your own adventure.