%let gpath= 'C:\'; %let dpi=200; title; footnote; ods html close; /*--Generate data--*/ data spaghetti; pi=constant("PI"); length Location $ 8 case $4; label y='Adoption Rate' x='Days'; a1=10; a2=5; d1=0.2; v=1; Location='USA'; Year=2013; do id=1 to 6; if mod(id, 2)=0 then case='Even'; else case='Odd'; do x=1 to 500 by 5; y=a1*sin(x*pi/180)+a2*sin(2*x*pi/180+d1)-v*id +30; output; end; end; Location='USA'; Year=2014; do id=7 to 12; if mod(id, 2)=0 then case='Even'; else case='Odd'; do x=1 to 500 by 5; y=a1*sin(x*pi/180)+a2*sin(2*x*pi/180+d1)-v*id +30 -2; output; end; end; a1=10; a2=3; d1=0.4; v=0.8; Location='Europe'; Year=2013; do id=13 to 18; if mod(id, 2)=0 then case='Even'; else case='Odd'; do x=1 to 500 by 5; y=a1*cos(x*pi/180)+a2*cos(2*x*pi/180+d1)-v*id +30; output; end; end; Location='Europe'; Year=2014; do id=19 to 24; if mod(id, 2)=0 then case='Even'; else case='Odd'; do x=1 to 500 by 5; y=a1*cos(x*pi/180)+a2*cos(2*x*pi/180+d1)-v*id +30 -2; output; end; end; run; /*--GTL template for Series with multiple classifications--*/ proc template; define statgraph MultiClassSeries; begingraph / subpixel=on; entrytitle 'Adoption Rate over Time by Location and Year'; layout overlay / yaxisopts=(offsetmin=0.1); seriesplot x=x y=y / group=id name='a' lineattrs=(thickness=2) linecolorgroup=Location linepatterngroup=year; discretelegend 'a' / title='Location:' type=linecolor location=inside valign=bottom halign=right; discretelegend 'a' / title='Year:' type=linepattern location=inside valign=bottom halign=left itemsize=(linelength=30px); endlayout; endgraph; end; run; /*--Render the graph--*/ ods listing image_dpi=&dpi; ods graphics / reset width=5in height=3in imagename='Spaghetti_GTL'; proc sgrender data=spaghetti template=MultiClassSeries; run;