%let gpath=C:\; ods html close; %let w=5in; %let h=3in; %let dpi=200; ods listing style=htmlblue gpath="&gpath" image_dpi=&dpi; /*--Generate data--*/ data series; label A='Drug A' B='Drug B' C='Drug C'; label LabelA='Response'; format Date Date9.; do j=0 to 3; Group=j; do k=0 to 90 by 5; i=j*90 + k; date='01jan2009'd+i; A = 10+ 3*sin(i/90+0.5) + 1*sin(3*i/90+0.7); output; end; end; run; /*--Define Attr Map for group values using FORMATTED data--*/ data discreteMap; length value LineColor $8; Id='X'; Value="0"; LineColor='red'; LineThickness=3; output; Id='X'; Value="1"; LineColor='gold'; LineThickness=3; output; Id='X'; Value="2"; LineColor='gold'; LineThickness=5; output; Id='X'; Value="3"; LineColor='green'; LineThickness=5; output; run; /*--Series with varying attributes--*/ ods graphics / reset attrpriority=color width=&w height=&h imagename="Series_Discrete"; title 'Response and Type over time'; proc sgplot data=series noborder dattrmap=discreteMap subpixel; series x=date y=a / group=group attrid=X; xaxis display=(noline noticks nolabel) grid; yaxis display=(noline noticks nolabel) grid; keylegend / linelength=20; run; /*--Generate data--*/ data series2; label A='Drug A' B='Drug B' C='Drug C'; label LabelA='Response'; format Date Date9.; do j=0 to 90; Group=j; do k=0 to 3; i=j*3 + k; date='01jan2009'd+i; A = 10+ 3*sin(i/90+0.5) + 1*sin(3*i/90+0.7); B = 5+ 3*sin(i/90+0.5) + 1*cos(3*i/90+0.7); C = 10+ 3*cos(i/90+0.5) + 1*sin(3*i/90+0.7); output; end; end; run; /*--Series with varying attributes--*/ ods graphics / reset attrpriority=color attrpriority=color width=&w height=&h imagename="Series_Range2"; title 'Response Y and color mapped to same variable'; proc sgplot data=series2 noborder subpixel; series x=date y=c / group=j colorresponse=c colormodel=(red gold green) lineattrs=(thickness=2); xaxis display=(noline noticks nolabel) grid; yaxis display=(noline noticks nolabel) grid; keylegend / linelength=20; run;