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.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 2 replies
  • 1169 views
  • 2 likes
  • 2 in conversation