I have data on three participants, that have roughly the same time-points for measurements of lactate (0,3,6,9,12,15,18,21,24). I currently have a line graph displaying each participants values, but want to add another "participant" that is the average of the whole group so it shows up as another line in the graph. Here is how the data looks. Name Measurement Value Time_Point Pre_Post Group A Lactate -1 Pre 1 A Lactate 10.99 3 Post 1 A Lactate 4.34 5.5 Post 1 A Lactate 6.11 9 Post 1 A Lactate 1.15 12 Post 1 A Lactate 16 Post 1 A Lactate 21 Post 1 A Lactate 1.42 24 Post 1 B Lactate -1 Pre 1 B Lactate 11.86 3 Post 1 B Lactate 11.45 6 Post 1 B Lactate 7.16 9 Post 1 B Lactate 3 12 Post 1 C Lactate -1 Pre 1 C Lactate 10.99 3 Post 1 C Lactate 14.21 6.5 Post 1 C Lactate 6.47 9.5 Post 1 C Lactate 3.87 13 Post 1 C Lactate 3.08 15 Post 1 C Lactate 2.92 17.5 Post 1 C Lactate 5.79 20.5 Post 1 C Lactate 2.72 24 Post 1 I currently have this code to make the dataset above: Data Name.group1_V_Lactate; set work.venous_long; where Group= 1 and Measurement= 'Lactate'; if time_point <0 then time_point=-1; If 0 <= time_point <=3.5 then time_point=3; else if 3< time_point =<6.5 then time_point=6; else if 6< time_point =<9.5 then time_point=9; else if 9< time_point =<12.5 then time_point=12; else if 12< time_point =<15.5 then time_point=15; else if 15< time_point =<18.5 then time_point=18; else if 18< time_point =<21.5 then time_point=21; else if 21< time_point =<24.5 then time_point=24; run; And am using this code to produce the series plot, but want to add a fourth name that is the average of the three participants to show up in the graph. What is the best way to do this, i assume it would be in the data step to use means(of ...) and make a new variable, but not sure how to do this for each time point. proc sgplot data=name.group1_V_Lactate; Title "Group 1 Venous Lactate levels"; series x=time_point y=Value / group=name markers; refline 0 / axis=x label= "Surgery"; xaxis values=(-2 -1 0 1 3 6 9 12 15 18 21 24) grid; xaxis label = "Time of Collection Since Surgery (hours)"; yaxis min=0 max=15 values=(0,0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,5.5,6.0,6.5,7.0,7.5,8.0,8.5,9.0,9.5, 10.0,10.5,11.0,11.5,12.0,12.5,13.0,13.5,14.0,14.5,15.0) grid; yaxis label = "mmol/L"; run;
... View more