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. 

 

 

 

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