I'm trying to create a spaghetti plot to compare a treatment group to a control group, with a color change or other style change once an individual reaches a certain period of time. Each patient has up to six interviews, with the assessment given at every interview. At some point into each participant's progression, Covid begins. We want to see the line format change when they attend interviews during Covid. Since each person started at different dates, some participant's interviews are mostly pre-covid or during covid. Each interview is numbered 0, 1, 3, 6, 9, 12 based on the anticipated month into the study. Data are in long format, with an indicator variable for when their interview took place during covid. SIQTotal is the assessment of interest. This snippet just happens to have covid happen in their last assessment, but the whole data are more varied. data WORK.SPAGPLOT;
infile datalines dsd truncover;
input participant_id:BEST12. intervention:BEST12. interview:BEST12. covid_era:BEST12. SIQTotal:BEST12.;
format participant_id BEST12. intervention BEST12. interview BEST12. covid_era BEST12. SIQTotal BEST12.;
label participant_id="participant_id";
datalines;
1 0 0 0 165
1 0 1 0 172
1 0 3 0 163
1 0 6 0 172
1 0 9 0 133
1 0 12 1 180
2 0 0 0 70
2 0 1 0 59
2 0 3 0 58
2 0 6 0 60
2 0 9 0 59
2 0 12 1 58
;;;; I'm pretty new to graphing in SAS and I've been using sgplot for the first time, used this code just to compare the intervention group vs the control group but now want to add a format change to indicate the covid-period interviews (maybe something like solid red to dashed red, solid blue to dashed blue? or Red to some other color, Blue to some other color?). proc sgplot data=work.spagplot;
series x=interview y=siqtotal/group=participant_id grouplc=intervention name='grouping';
xaxis values=(0 to 12 by 3);
keylegend 'grouping'/type=linecolor;
title 'SIQTotal individual scores over interview';
format intervention intervention.;
run; Any advice would be appreciated.
... View more