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

Hi All,

 

I trying to develop the scatter plot by using proc sgplot.

Min and max values are negative to positive , i wan to show 0 on in the y-axis.

 

proc sgplot data=have;

 scatter y=pct x=dur/group=col

yaxis values=(&min to &max by 10);

...

...

run;

 

for example min is -140 & max is 200

I want yaxis like below

     -140 -120 -100 -80 -60 -40 -20 0 20 40 60 80 100 120 140 160 180 200

 

Thanks

Sam

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

You shown values of -130 -110 -90 -70 -50 -30 -10 10 30 50 70 90 110 130 150 170 190 are because you are using BY 20.

yaxis values = (-130 to -10 by 20 0 10 to 190 by 20) may work.

 

Simplier might be (-140 to 200 by 20) so 0 appears as a multiple of 20 added to -140.

 

 

View solution in original post

4 REPLIES 4
ballardw
Super User

You are missing a semicolon at the end of the Scatter statement.

 

If you are getting errors please post them.

If the results are just not showing all the values then it may be a result of the amount of space your default graph has available.

If something else, then post data in a data step and the complete proc code you have used.

sam369
Obsidian | Level 7

Hi ,

 

Thank you for the response!!!

 

I am not getting the errors.  Missing semicolon is a typo.

i am using :

yaxis values=(&min to &max by 5);

 

My values on the plot is getting like this

 

-130 -110 -90 -70 -50 -30 -10 10 30 50 70 90 110 130 150 170 190

 

want:

 

-130 -110 -90 -70 -50 -30 -10 0 10 30 50 70 90 110 130 150 170 190 

 

ballardw
Super User

You shown values of -130 -110 -90 -70 -50 -30 -10 10 30 50 70 90 110 130 150 170 190 are because you are using BY 20.

yaxis values = (-130 to -10 by 20 0 10 to 190 by 20) may work.

 

Simplier might be (-140 to 200 by 20) so 0 appears as a multiple of 20 added to -140.

 

 

sam369
Obsidian | Level 7

Thank you so Much

 

work like a champ

 

Sam

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!

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