/*subsetting the table to get only subjid, visit and visiopro */
proc sql;
create table pro as
select *
from ana.PRO_F_ADQS2(keep=d_SUBJID d_VISITN d_VPD5_Tot)
where d_SUBJID IN ( '05-07','05-08','05-09','05-10','05-11');
quit;
/* Count the number of unique values of SUBJECT. */
/* Also create macro variables containing the */
/* style values for each plot line. The line */
/* color is based on the visit. */
data total_dup1;
length color $5.;
set pro end=eof;
by d_SUBJID;
if d_VISITN=1 then color='vibg';
if d_VISITN=2 then color='red';
if d_VISITN=3 then color='black';
if d_VISITN=4 then color='depk';
if first.d_SUBJID then do;
count+1;
call symput('gd'||trim(left(count)),
'style '|| 'GraphData' || trim(left(count)) ||
' from GraphData' || trim(left(count)) ||
' / ContrastColor=' || trim(left(color)) ||
' linestyle=1;');
end;
if eof then call symput('total',count);
run;
/* Define a macro that generates all style changes. */
%macro gdata;
%do i=1 %to &total;
&&gd&i
%end;
%mend gdata;
/* Create the custom style. */
proc template;
define style styles.mystyle;
parent=styles.default;
%gdata;
end;
run;
/*formatting the values to get the desred lenged values*/
proc format;
value visit
1 = 'Baseline'
2 = 'Timepoint 2'
3 = 'Timepoint 3'
4 = 'Timepoint 4';
run;
ods rtf file='C:\Users\ravindra.babu\OneDrive - OneWorkplace\Projs\NO8072A - RP PRO\NO8072A_F2_1_v_01.rtf'
style=rtf bodytitle nogfootnote;
goptions reset=all;
ods graphics / border=off width=18cm height=8cm ;
ods graphics / border=off width=17cm height=8.5cm;
/*ods rtf file='C:\Users\ravindra.babu\OneDrive - OneWorkplace\Projs\NO8072A - RP PRO\NO8072A_F2_1_v_01.rtf' style=styles.mystyle; */
proc sgplot data=total_dup1 noautolegend;
series x=d_VISITN y=d_VPD5_Tot / group=d_SUBJID grouplc=count;
xaxis label="Visit" values=(1 to 4 by 1);
yaxis label="Total" values=(0 to 5 by 1);
format d_VISITN visit.;
title "Figure 2.1. Individual patients ViSIO-PRO total score at each visit (PRO treated analysis population, N=5)";
/* Use a FOOTNOTE statement to simulate a legend. */
footnote1 box=1 bcolor=white
'Note: The PRO Treated Analysis Population are adult and adolescent patients who have received Luxturna treatment with at least one item completed on the ViSIO-PRO at one pre-Luxturna treatment timepoint (baseline) and at least one item completed on the ViSIO-PRO at one post-Luxturna treatment follow-up timepoint. ViSIO-PRO total score ranges from 0 to 5 with higher scores indicating worse visual functioning or HRQoL.' ;
run;
quit;
ods rtf close;
The above is my code, i dont know where i am doing wrong, the graphs doesn't give different colors for each line all i get is the same colour but the legend appears to be in different colour, can someone help me please to get different colours for different lines.
... View more