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

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. 

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

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;

 SGPlot1.pngSGPlot.png

View solution in original post

2 REPLIES 2
Rick_SAS
SAS Super FREQ

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;

 SGPlot1.pngSGPlot.png

madsgregers
Calcite | Level 5
Thanks, Ric. I don't know why it didn't work for me - but it does now! Have a nice day.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 2005 views
  • 2 likes
  • 2 in conversation