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;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.