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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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