I am using PROC SGPANEL to separate the data for the 2 groups, male and female. I need to have the scatter plot showing all subjects data points and the average value plot. I need to combine the graphs together, so the scatter plot and mean line are on the same plot. My data
DATA PROYDATA;
INPUT GROUP ID AGE8 AGE10 AGE12 AGE14 @@;
CARDS;
1 1 26.0 25.0 29.0 31.0 1 2 21.5 22.5 23.0 26.5 1 3 23.0 22.5 24.0 27.5
1 4 25.5 27.5 26.5 27.0 1 5 20.0 23.5 22.5 26.0 1 6 24.5 25.5 27.0 28.5
1 7 22.0 22.0 24.5 26.5 1 8 24.0 21.5 24.5 25.5 1 9 23.0 20.5 31.0 26.0
1 10 27.5 28.0 31.0 31.5 1 11 23.0 23.0 23.5 25.0 1 12 21.5 23.5 24.0 28.0
1 13 17.0 24.5 26.0 29.5 1 14 22.5 25.5 25.5 26.0 1 15 23.0 24.5 26.0 30.0
1 16 22.0 21.5 23.5 25.0
2 1 21.0 20.0 21.5 23.0 2 2 21.0 21.5 24.0 25.5 2 3 20.5 24.0 24.5 26.0
2 4 23.5 24.5 25.0 26.5 2 5 21.5 23.0 22.5 23.5 2 6 20.0 21.0 21.0 22.5
2 7 21.5 22.5 23.0 25.0 2 8 23.0 23.0 23.5 24.0 2 9 20.0 21.0 22.0 21.5
2 10 16.5 19.0 19.0 19.5 2 11 24.5 25.0 28.0 28.0
RUN;
/* set up the data in univariate format */
DATA Unidata;
SET Proydata;
ARRAY AgeVector(4) Age8--Age14;
Subject + 1;
DO Time = 1 TO 4;
Age = 2*Time + 6;
Dental = AgeVector(Time);
OUTPUT;
END;
DROP Age8--Age14;
RUN;
* get a sorted dataset by Group and Age;
DATA SortData;
SET Unidata;
PROC SORT;
BY GROUP Age;
RUN;
This is what I used for the two plots, and I would like for the plots to be separated by group.
PROC SGPANEL NOAUTOLEGEND DATA=Unidata;
PANELBY GROUP;
* observed trends;
SERIES X=Age Y=Dental / GROUP = Subject LINEATTRS = (THICKNESS=1);
FORMAT GROUP GROUP.;
PROC SGPANEL DATA=Sortdata;
PANELBY GROUP;
* mean trends;
VLINE Age /RESPONSE=Dental STAT=MEAN
GROUP=GROUP LINEATTRS=(THICKNESS=2) MARKERS MARKERATTRS=(SIZE=2MM) DATALABEL;
FORMAT GROUP GROUP.;
RUN;
Here is my output enter image description here How can I easily combine these 2 plots?