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

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

1 ACCEPTED SOLUTION

Accepted Solutions
Jay54
Meteorite | Level 14

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.

View solution in original post

3 REPLIES 3
Reeza
Super User
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 🙂

 

 

Jay54
Meteorite | Level 14

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.

mattmied_yahoo_com
Calcite | Level 5

Thanks, that worked!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 3 replies
  • 2874 views
  • 1 like
  • 3 in conversation