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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 672 views
  • 0 likes
  • 2 in conversation