BookmarkSubscribeRSS Feed
Goyo
Calcite | Level 5

My first post to SAS communities...

I want the fitted data (red dots) in the scatterplot below to be a line rather than a set of dots. I don't see a way an option within the scatter statement to change the circles to lines. Any suggestions?  (My code below.)

 

proc sgplot data=pred1;
scatter x=eucdist y= HTp; *blue circles;
scatter x=eucdist y= HTp_pred; *red circles;
run;

 

Goyo_0-1616099699108.png

 

3 REPLIES 3
Reeza
Super User

SCATTER creates a scatter plot.
Use SERIES to create a line plot instead.
Everything else can stay the same.

 

EDIT: REG can do both at once though, without the pre-calculation as well. Remove the CLM/CLI to remove the prediction and confidence intervals. You could do all three together to test that if you'd like. 

 

 

proc sgplot data=sashelp.class;
  reg x=height y=weight / CLM CLI;
run;

 

 

ballardw
Super User

@Reeza wrote:

SCATTER creates a scatter plot.
Use SERIES to create a line plot instead.
Everything else can stay the same.

 

EDIT: REG can do both at once though, without the pre-calculation as well. Remove the CLM/CLI to remove the prediction and confidence intervals. You could do all three together to test that if you'd like. 

 

 

proc sgplot data=sashelp.class;
  reg x=height y=weight / CLM CLI;
run;

 

 


Data shows enough of a curve you may want the DEGREES=2 option to fit a quadratic in the Sgplot REG statement.

Rick_SAS
SAS Super FREQ
proc sort data=pred1; by eucdist; run;

proc sgplot data=pred1;
scatter x=eucdist y= HTp; *blue circles;
series x=eucdist y= HTp_pred / lineattrs=GraphData2; *line in contrasting color;
run;

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!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 730 views
  • 5 likes
  • 4 in conversation