%let gpath='C:\';
%let dpi=100;
ods html close;
ods listing style=htmlblue gpath=&gpath image_dpi=&dpi;
/*--Grouped Series Plot--*/
data SeriesGroup1;
length Severity $8;
format Date Date9.;
do i=0 to 360;
date='01jan2009'd+i;
Severity='Mild'; Val = 6+ 3*cos(i/90+0.5) + 1*sin(3*i/90+0.7);
if mod (i, 30) =0 then val2=val; output;
Severity='Moderate'; Val = 16+ 3*sin(i/90+0.5) + 1*sin(3*i/90+0.7);
if mod (i, 30) =0 then val2=val; output;
Severity='Severe'; Val = 10+ 3*sin(i/90+0.5) + 1*cos(3*i/90+0.7);
if mod (i, 30) =0 then val2=val; output;
val2=.;
end;
run;
data SeriesGroup2;
length Severity $8;
format Date Date9.;
do i=0 to 360;
date='01jan2009'd+i;
Severity='Mild'; Val = 6+ 3*cos(i/90+0.5) + 1*sin(3*i/90+0.7);
if mod (i, 30) =0 then val2=val; output;
Severity='Severe'; Val = 10+ 3*sin(i/90+0.5) + 1*cos(3*i/90+0.7);
if mod (i, 30) =0 then val2=val; output;
val2=.;
end;
run;
/*proc print;run;*/
/*--Series with Group 3 Severity--*/
ods graphics / reset width=5in height=3in antialiasmax=1100 imagename='SeriesGroup1';
title 'Response over Time by Treatment';
proc sgplot data=SeriesGroup1;
series x=date y=val / group=Severity lineattrs=(thickness=3);
scatter x=date y=val2 / group=Severity markerattrs=(symbol=circlefilled size=11);
xaxis display=(nolabel);
yaxis label='Response';
run;
/*--Series with Group 2 Severity--*/
ods graphics / reset width=5in height=3in antialiasmax=1100 imagename='SeriesGroup2';
title 'Response over Time by Treatment';
proc sgplot data=SeriesGroup2;
series x=date y=val / group=Severity lineattrs=(thickness=3);
scatter x=date y=val2 / group=Severity markerattrs=(symbol=circlefilled size=11);
xaxis display=(nolabel);
yaxis label='Response';
run;
/*--Define attributes map data set--*/
data AttrMap;
length id value linecolor markercolor $8;
id='Severity'; value='Severe'; linecolor='Red'; markercolor='Red'; output;
id='Severity'; value='Moderate'; linecolor='Orange'; markercolor='Orange'; output;
id='Severity'; value='Mild'; linecolor='Green'; markercolor='Green';output;
run;
ods html;
proc print;run;
ods html close;
/*--Series with Attr Map - 3 Severity--*/
ods graphics / reset width=5in height=3in antialiasmax=1100 imagename='SeriesMap1';
title 'Response over Time by Treatment';
proc sgplot data=SeriesGroup1 dattrmap=AttrMap;
series x=date y=val / group=Severity lineattrs=(thickness=3) attrid=Severity;
scatter x=date y=val2 / group=Severity attrid=Severity markerattrs=(symbol=circlefilled size=11);
xaxis display=(nolabel);
yaxis label='Response';
run;
/*--Series with Attr Map - 2 Severity--*/
ods graphics / reset width=5in height=3in antialiasmax=1100 imagename='SeriesMap2';
title 'Response over Time by Treatment';
proc sgplot data=SeriesGroup2 dattrmap=AttrMap;
series x=date y=val / group=Severity lineattrs=(thickness=3) attrid=Severity;
scatter x=date y=val2 / group=Severity attrid=Severity markerattrs=(symbol=circlefilled size=11);
xaxis display=(nolabel);
yaxis label='Response';
run;
title;
/*--Series with Attr Map Legend from AttrMap--*/
proc template;
define statgraph seriesMap;
begingraph;
entrytitle 'Response over Time by Treatment';
discreteattrmap name='AttrMap';
value 'Mild' / lineattrs=(color=green) markerattrs=(color=green) fillattrs=(color=green);
value 'Moderate' / lineattrs=(color=orange) markerattrs=(color=orange) fillattrs=(color=orange);
value 'Severe' / lineattrs=(color=red) markerattrs=(color=red) fillattrs=(color=red);
enddiscreteattrmap;
discreteattrvar attrvar=AttrSeverity var=Severity attrmap='AttrMap';
layout overlay;
seriesplot x=date y=val / group=AttrSeverity lineattrs=(thickness=3);
scatterplot x=date y=val2 / group=AttrSeverity markerattrs=(symbol=circlefilled size=11);
discretelegend 'AttrMap' / title='Severity:' type=fill;
endlayout;
endgraph;
end;
run;
ods graphics / reset width=5in height=3in antialiasmax=1100 imagename='SeriesMapGTL';
proc sgrender data=SeriesGroup2 template=seriesMap;
run;