HI,
I am trying to create a uniform set of charts, as such I would like them all to have the same scale on my first axis, is there a way to set the axis so they all are the same. Here is the code I am working with, I tried to add the yaxisopts but keep getting an error.
Thanks
%LET gpath=C:\;
data On;
input @1 Car $4. @6 SASDate mmddyy10. @17 OnRent 4. @22 OnRent1 4.;@22 OnRent1 4.;
datalines;
Blue,01/01/1970,0.90,0.90
Blue,02/01/1970,0.89,0.90
Blue,03/01/1970,0.85,0.90
Blue,04/01/1970,0.90,0.90
Blue,05/01/1970,0.85,0.90
Blue,06/01/1970,0.89,0.90
Blue,07/01/1970,0.91,0.90
Blue,08/01/1970,0.92,0.90
Blue,09/01/1970,0.93,0.90
Blue,10/01/1970,0.94,0.90
Grey,01/01/1970,0.70,0.68
Grey,02/01/1970,0.59,0.68
Grey,03/01/1970,0.55,0.68
Grey,04/01/1970,0.70,0.68
Grey,05/01/1970,0.55,0.68
Grey,06/01/1970,0.59,0.68
Grey,07/01/1970,0.71,0.68
Grey,08/01/1970,0.72,0.68
Grey,09/01/1970,0.73,0.68
Grey,10/01/1970,0.74,0.68
;
DATA ONBlue;
Set ON;
WHERE Car='Blue';
RUN;
DATA ONGrey;
Set ON;
WHERE Car='Grey';
RUN;
%Let dpi=100;
%Let w=8in;
%Let h=4.5in;
%Macro GraphUte;
%Do i = 1 %to 2;
%If &i=1 %then %do; %Let CarTypeN=Blue;%Let Vars=OnRent ;%Let C = Blue;%Let Data1=On&C.;%END;
%Else %If &i=2 %then %do; %Let CarTypeN=Grey;%Let Vars=OnRent ;%Let C = Grey;%Let Data1=On&C.;%END;
proc template;
define statgraph panel;
begingraph;
entrytitle "&CarTypeN. On Rent by &vars.";
*layout overlay / yaxisopts=linearopts=(tickvaluesequence=(start=0 end=70 increment=10) viewmin=0 viewmax=70));
layout gridded / rowgutter=5;
layout datapanel classvars=(Car) / rowaxisopts=(griddisplay=on) columnaxisopts=(tickvalueattrs=(size=7)griddisplay=on) columns=1 headerLabelDisplay=Value cellheightmin=50;
layout prototype / cycleattrs=true;
SeriesPlot X=SASDate Y=OnRent1 / primary=true display=(markers) markerattrs=(size=9px symbol=circlefilled) lineattrs=(thickness=2px) NAME="s1";
SeriesPlot X=SASDate Y=&Vars. / yaxis=y2 display=(markers) markerattrs=(size=9px symbol=circlefilled) lineattrs=(thickness=2px) NAME="s2";
endlayout;
endlayout;
*Endlayout;
DiscreteLegend "s1" "s2" /;
endlayout;
endgraph;
end;
run;
Title "";
/*--Render graph--*/
ods listing style=htmlblue gpath="&graphs." image_dpi=&dpi;
ods graphics / reset width=&w height=&h imagename="&C.UteByVar";
proc sgrender data=&Data1. template="panel";
run;
%END;
%Mend GraphUte;
%GraphUte
Reeza's suggestion will work. With your code, you can add TICKVALUEPRIORITY= true to force the axis to use the value range define in the tick value option.
linearopts=(viewmin=0 viewmax=70 tickvaluelist=(0 10 20 30 40 50 60 70));
I think yaxisopts is the correct location and specified as above.
At least for survival graphs 🙂
Reeza's suggestion will work. With your code, you can add TICKVALUEPRIORITY= true to force the axis to use the value range define in the tick value option.
Thanks, that worked!
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.