proc format; value group 9='< 5' 8='5-10' 7='11-15' 6='16-20' 5='21-25' 4='26-30' 3='31-35' 2='35 +' 1='Total'; run; /*--Generate stacked series data--*/ data _null_; format y group.; pi=constant('PI'); length x y 8; retain yo 1 ymin 1e10 ymax -1e10; drop pi yo ymin ymax; /*--Declare the Hash Object--*/ declare hash h(ordered:'a'); declare hiter iter('h'); rc=h.defineKey('x'); rc=h.defineData('x', 'y', 'group'); rc=h.defineDone(); do group = 1 to 9; h.clear(); phase=ranuni(2); do x=0 to pi/2.0 by 0.02; y=sin(x+phase)+0.5*ranuni(2); rc=h.add(); ymin=min(ymin, y); ymax=max(ymax, y); end; yrange=ymax-ymin; count=h.num_items; rc=iter.first(); do i=1 to count; y=0.9*(y-ymin)/yrange - 0.45 + yo; h.replace(); rc=iter.next(); end; h.output (dataset:'spark_'|| put (group, 1.0)); yo = yo+1; end; run; data spark; set spark_1 spark_2 spark_3 spark_4 spark_5 spark_6 spark_7 spark_8 spark_9; run; /*--Generate statistics and URLs--*/ data stats; length url $60; input group2 Y2008 Y2009 url; if mod(_n_, 2) ne 0 then ref=group2; format group2 group.; y2008label='2008'; y2009label='2009'; x1=0; x2=constant('PI') / 2.0; datalines; 1 22 56 http://www.sas.com 2 25 60 http://www.support.sas.com 3 19 45 http://www.dell.com 4 16 32 http://www.google.com 5 27 64 http://www.yahoo.com 6 22 56 http://www.ibm.com 7 25 60 http://www.cisco.com 8 19 45 http://www.oracle.com 9 16 32 http://www.sas.com ; run; /*--Merge series and statistics data--*/ data all; set spark stats; run; /*proc print label;run;*/ %let gpath='C:\'; ods listing gpath=&gpath image_dpi=100; ods graphics / reset width=4in height=2.5in antialiasmax=1000 imagename='Spark_Table_SG'; title h=1 'How many people are unemployed and for how long'; proc sgplot data=all noautolegend; refline ref / lineattrs=(thickness=20) transparency=0.85; series x=x y=y / group=group lineattrs=graphdatadefault(pattern=solid); scatter y=group2 x=y2008label / markerchar=y2008 x2axis url=url; scatter y=group2 x=y2009label / markerchar=y2009 x2axis url=url; xaxis display=none offsetmin=0.02 offsetmax=0.25; x2axis display=(nolabel noticks) offsetmin=0.8; yaxis values=(1 to 9) display=(nolabel noticks); run; ods html; ods graphics / reset width=4in height=2.5in antialiasmax=1000 imagename='Spark_Table_SG_URL' imagemap tipmax=1000; title 'How many people are unemployed and for how long'; proc sgplot data=all noautolegend; refline ref / lineattrs=(thickness=27) transparency=0.85; series x=x y=y / group=group lineattrs=graphdatadefault(pattern=solid); scatter y=group2 x=y2008label / markerchar=y2008 x2axis url=url; scatter y=group2 x=y2009label / markerchar=y2009 x2axis url=url; xaxis display=none offsetmax=0.25; x2axis display=(nolabel noticks) offsetmin=0.8; yaxis values=(1 to 9) display=(nolabel noticks); run; ods html close;