BookmarkSubscribeRSS Feed
starz4ever2007
Quartz | Level 8

Is there a way you can plot the mean of y at each x on a scatterplot:

 

proc sgplot DATA = new (where = (include=1));
scatter x= week y= totalscore;

xaxis label = 'Week' VALUES = (1 TO 16 by 4);
yaxis label = 'Total Score' VALUES = (-32 TO 20 BY 4);
run;

 

The above syntax gives me everyone's score at each week, which is perfect but I essentially would like the graph to also display the mean of total score at each week and connect the points as a line (my data shows that as the weeks go by the mean of total score goes lower)

1 REPLY 1
Reeza
Super User

Unfortunately you probably need to pre-calculate it and plot it as a separate series. 

You can add a SERIES statement to the proc to graph the line. 

 

 

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 374 views
  • 0 likes
  • 2 in conversation