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

I am trying to control the range of the axe, (SAS 9.4), but the range is still set automatically. The code is:

 

proc sgplot data=GAL.DIET_OBESITY_CORR;

              xaxis values=(0 to 60 by 10);

              yaxis values=(0 to 70 by 10);

              xaxis label="low vegetable eaters,%";

              yaxis label="low fruits eaters, %";

              scatter x=little_vegetables y=little_fruits;

              ellipse x=little_vegetables y=little_fruits

                             /lineattrs=GraphData1 (thickness=3);

run;

 

Also does’t work:

xaxis min=0 xaxis max=60;

yaxis min=0 yaxis max=70;

 

This is in particular confusing, since the example based on https://blogs.sas.com/content/graphicallyspeaking/2012/01/19/they-go-where-you-put-them/ does work, I can play with the range and get the axes as defined by the code:

 

proc sgplot data=sashelp.class;

              xaxis values=(0 to 60 by 10);

              yaxis values=(0 to 70 by 10);

              scatter x=weight y=height / group=sex datalabel=weight;

run;

 

Anyone can spot the problem?

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

You have multiple XAXIS statements. The second XAXIS statement overwrites and eliminates the first XAXIS statement. Same for YAXIS.

 

Put all XAXIS options in one statement:

 

  xaxis values=(0 to 60 by 10) label="low vegetable eaters,%";
--
Paige Miller

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26

You have multiple XAXIS statements. The second XAXIS statement overwrites and eliminates the first XAXIS statement. Same for YAXIS.

 

Put all XAXIS options in one statement:

 

  xaxis values=(0 to 60 by 10) label="low vegetable eaters,%";
--
Paige Miller
ballardw
Super User

In many procedures certain statements are expected only once. In which case it appears that most often the LAST one appearing the code will be applied.

 

Try commenting out the XAXIS with the label and see what happens. Likely get the range but the label will default back to the variable name.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 769 views
  • 0 likes
  • 3 in conversation