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

Hi all,

I believe the answer for this should be simple but going through all the sas documentation for SGplots has given me nothing that works.

I'm using sas 9.4

I'm trying to standardize the range of the X axis between 50 and 90 in a simple regression.

 

I have the following code

 

proc SGplot data=have;

by task;

reg x=year y=score / nomarkers group=group clm clmtransparency=0.6;

Xaxis values= (50 TO 90 by 5) ranges=(50-90);

Xaxis label= "Age years";

run;

 

I first tried with a min and max statement, doesn't work because that's just the values, then the Values as that defines the tick marks and I figured it would show all the tick marks i asked for, but that didn't work either. Then ranges but that is for splitting ranges

Any idea how i can have the x axis range between 50 and 90 ?

Thanks heaps.

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

@P20 wrote:

Hi all,

I believe the answer for this should be simple but going through all the sas documentation for SGplots has given me nothing that works.

I'm using sas 9.4

I'm trying to standardize the range of the X axis between 50 and 90 in a simple regression.

 

I have the following code

 

proc SGplot data=have;

by task;

reg x=year y=score / nomarkers group=group clm clmtransparency=0.6;

Xaxis values= (50 TO 90 by 5) ranges=(50-90);

Xaxis label= "Age years";

run;

 

I first tried with a min and max statement, doesn't work because that's just the values, then the Values as that defines the tick marks and I figured it would show all the tick marks i asked for, but that didn't work either. Then ranges but that is for splitting ranges

Any idea how i can have the x axis range between 50 and 90 ?

Thanks heaps.


The first "xaxis" that you ended with a ; is ignored because you included an entire additional XAXIS statement. You may only have one XAXIS statement and the last in the code will likely be the one to be applied.

Try

Xaxis values= (50 TO 90 by 5) ranges=(50-90) 
          label= "Age years";

View solution in original post

4 REPLIES 4
Ksharp
Super User

I don't understand your quesiton.

If you want limit the X value,you can exclude these points by :

 

proc SGplot data=have(where=(year between 50 and 90));

 

And Better post a sample data to test your code ,that would better help to explain your Q.

P20
Calcite | Level 5 P20
Calcite | Level 5
Sorry ksharp and thank you for your suggestion, i didn't think sample data would clarify but i will add some as soon as i get to my computer

I want a regression plot where there the x axis ranges from 50 to 90. With tick marks every 5 years.

With the code i have above i have some plots that have an x axis that begins at 50 and have tick marks by 10, and end at 90, some that begin with 70 and have tick marks by 20. The program chooses where the x axis begins and what values and tick marks are chosen and displayed.

Using excel i can choose to have each plot have an x axis begin where i want and end where i want. This makes comparing plots easy. I cant seem to find an option to do the same in sas.
ballardw
Super User

@P20 wrote:

Hi all,

I believe the answer for this should be simple but going through all the sas documentation for SGplots has given me nothing that works.

I'm using sas 9.4

I'm trying to standardize the range of the X axis between 50 and 90 in a simple regression.

 

I have the following code

 

proc SGplot data=have;

by task;

reg x=year y=score / nomarkers group=group clm clmtransparency=0.6;

Xaxis values= (50 TO 90 by 5) ranges=(50-90);

Xaxis label= "Age years";

run;

 

I first tried with a min and max statement, doesn't work because that's just the values, then the Values as that defines the tick marks and I figured it would show all the tick marks i asked for, but that didn't work either. Then ranges but that is for splitting ranges

Any idea how i can have the x axis range between 50 and 90 ?

Thanks heaps.


The first "xaxis" that you ended with a ; is ignored because you included an entire additional XAXIS statement. You may only have one XAXIS statement and the last in the code will likely be the one to be applied.

Try

Xaxis values= (50 TO 90 by 5) ranges=(50-90) 
          label= "Age years";
P20
Calcite | Level 5 P20
Calcite | Level 5

That worked, thank you!

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

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
  • 4 replies
  • 983 views
  • 0 likes
  • 3 in conversation