Hi,
I have a problem with my y-axis in a sgplot. My code is:
proc sgplot data=mydata; vline informed / response=asked stat=mean limitstat=clm LEGENDLABEL = 'Average [95% CLM]' MARKERS LINEATTRS = (THICKNESS = 2); run;
Can I set the y-axis to a fixed interval? The highest value is 12.5 now, but I would like the y-axis to go up to 20 (despite I do not have any observations here but it is to compare this graph with another one so the y-axis is similar). I tried both the "yaxis min=0 max=20" and "yaxis values=(0 to 20 by 1)".
Thanks.
Both of your ideas should work. There must have been a problem with your implementation. Run the following program and see if it works for you:
data mydata;
call streaminit(1);
do x = 1 to 20;
do rep = 1 to 10;
y = 1.5 + abs(x-10) + rand("uniform");
end;
output;
end;
run;
proc sgplot data=mydata;
vline x / response=y stat=mean limitstat=clm LEGENDLABEL = 'Average [95% CLM]' MARKERS LINEATTRS = (THICKNESS = 2);
yaxis min=0 max=20 ;
run;
proc sgplot data=mydata;
vline x / response=y stat=mean limitstat=clm LEGENDLABEL = 'Average [95% CLM]' MARKERS LINEATTRS = (THICKNESS = 2);
yaxis values=(0 to 20 by 1);
run;
Both of your ideas should work. There must have been a problem with your implementation. Run the following program and see if it works for you:
data mydata;
call streaminit(1);
do x = 1 to 20;
do rep = 1 to 10;
y = 1.5 + abs(x-10) + rand("uniform");
end;
output;
end;
run;
proc sgplot data=mydata;
vline x / response=y stat=mean limitstat=clm LEGENDLABEL = 'Average [95% CLM]' MARKERS LINEATTRS = (THICKNESS = 2);
yaxis min=0 max=20 ;
run;
proc sgplot data=mydata;
vline x / response=y stat=mean limitstat=clm LEGENDLABEL = 'Average [95% CLM]' MARKERS LINEATTRS = (THICKNESS = 2);
yaxis values=(0 to 20 by 1);
run;
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!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.