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

Hi All,

 

I'm having problems with the SGPLOT refline option  I have provided an example .  Please see attached

1 ACCEPTED SOLUTION

Accepted Solutions
SuryaKiran
Meteorite | Level 14

You can define the start and end values for axis in XAXIS, YAXIS values. 

 

something like: YAXIS values=(&min to &max by 0.1)

 

You can get the max and min values from the dataset using proc sql INTO;

 

proc sql;

select max(var1),Min(var2) into: max,:min

from have;

quit;

 

If you want the yaxis to extend then add values to max like: YAXIS values=(&min to &max+2 by 0.1)

 

Check this example how to increase the yaxis lines:

proc sql;
select max(weight)+50,min(weight) into: max,:min
from sashelp.class;
quit;
options symbolgen;
proc sgplot data=sashelp.class;
  scatter x=height y=weight / group=sex;
  yaxis values=(&min to &max by 20);
run;

If you still don't get then please provide your sample data in the form of data step. Someone can sure help you if you clearly provide your requirement. 

https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat...

Thanks,
Suryakiran

View solution in original post

1 REPLY 1
SuryaKiran
Meteorite | Level 14

You can define the start and end values for axis in XAXIS, YAXIS values. 

 

something like: YAXIS values=(&min to &max by 0.1)

 

You can get the max and min values from the dataset using proc sql INTO;

 

proc sql;

select max(var1),Min(var2) into: max,:min

from have;

quit;

 

If you want the yaxis to extend then add values to max like: YAXIS values=(&min to &max+2 by 0.1)

 

Check this example how to increase the yaxis lines:

proc sql;
select max(weight)+50,min(weight) into: max,:min
from sashelp.class;
quit;
options symbolgen;
proc sgplot data=sashelp.class;
  scatter x=height y=weight / group=sex;
  yaxis values=(&min to &max by 20);
run;

If you still don't get then please provide your sample data in the form of data step. Someone can sure help you if you clearly provide your requirement. 

https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat...

Thanks,
Suryakiran

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
  • 1 reply
  • 1652 views
  • 0 likes
  • 2 in conversation