%let name=quad; filename odsout '.'; %let textcolor=cx4f584a; data mydata1; input risk return; symbol=1; datalines; 1.5 4.5 1.5 5.0 2.5 5.0 2.75 5.0 3.00 6.0 3.00 2.0 3.50 4.5 3.60 5.0 3.75 2.0 3.85 2.1 3.90 1.9 3.95 1.8 4.25 1.8 4.85 -3.0 5.30 4.0 5.50 -2.0 5.90 -1.5 6.00 -2.1 6.10 -1.6 6.90 -2.1 7.00 -4.0 14.00 -2.0 11.00 2.0 11.30 6.0 7.90 -1.0 7.85 0.0 7.80 1.01 7.70 -2.0 7.70 -4.0 7.30 -3.0 7.31 -3.05 7.2 -1.0 7.15 -3.0 15.5 -4.0 8.00 -6.0 8.10 -7.0 8.10 -4.0 8.10 -2.0 8.15 -3.0 8.20 -2.2 8.30 -3.1 8.33 -3.0 8.50 -3.5 8.51 -3.6 8.60 -4.0 8.70 -4.4 8.80 -7.5 9.00 -5.0 9.10 -4.5 8.70 -.05 8.90 -1.0 9.00 -1.4 8.95 -3.0 9.07 -3.0 9.10 -3.0 9.20 -2.6 9.50 -1.8 9.70 -1.1 10.0 -1.0 9.50 0.1 9.20 -7.0 9.40 -8.0 9.60 -6.0 9.10 -3.0 9.60 -4.0 9.70 -3.5 10.0 -8.0 12.9 -8.0 13.0 -9.0 13.3 -10.0 13.2 -7.0 13.2 -6.0 13.8 -6.0 13.9 -7.0 12.0 -7.0 12.1 -5.0 12.4 -4.0 12.4 -7.0 12.3 -8.0 12.5 -9.0 12.7 -8.0 11.0 -5.0 11.1 -11.0 11.2 -7.0 11.3 -7.5 11.4 -8.0 11.5 -8.2 11.7 -6.0 11.8 -8.0 11.9 -7.0 11.95 -11.1 10.0 -4.0 10.0 -3.01 10.1 -4.1 10.1 -3.1 10.4 -2.8 10.4 -4.0 11.0 -3.0 10.95 -4.0 11.0 -4.5 11.3 -2.6 10.0 -5.5 10.02 -5.7 10.0 -8.0 10.1 -9.0 10.1 -8.0 10.11 -8.01 10.1 -6.0 10.15 -6.0 10.5 -6.0 10.51 -6.05 10.48 -6.08 10.6 -11.0 10.7 -9.0 10.9 -9.5 11.0 -7.0 10.97 -9.0 13.0 -9.0 ; run; data mydata2; input symbol risk return; datalines; 2 9.9 -6.6 3 9.0 -6.7 4 10.5 -7.7 5 17.9 -16.1 6 3.3 9.8 ; run; data mydata2; set mydata2; length myhtml $300 fundtext $100; if (symbol eq 2) then fundtext='MGR COMPOSITE'; else if (symbol eq 3) then fundtext='ALLOC INDEX'; else if (symbol eq 4) then fundtext='POLICY INDEX'; else if (symbol eq 5) then fundtext='S&P 500'; else if (symbol eq 6) then fundtext='LB AGGREGATE'; myhtml='title='||quote( trim(left(fundtext))||': Risk='||trim(left(risk))||' Return='||trim(left(return)) ) || ' '|| 'href="alloc.htm"'; run; data mydata; set mydata1 mydata2; run; proc sql noprint; select mean(risk) into :mean_risk from mydata; select mean(return) into :mean_return from mydata; quit; run; data anno_means; when='a'; length text $80; function='label'; style='"arial/bold"'; color='red'; hsys='3'; size=2.25; text='Mean Risk = '||trim(left(put(&mean_risk,comma5.1))); xsys='2'; x=&mean_risk; ysys='1'; y=100; position='1'; angle=90; output; text='Mean Return = '||trim(left(put(&mean_return,comma5.1))); ysys='2'; y=&mean_return; xsys='1'; x=100; position='1'; angle=0; output; run; /* Annotate a white background within the axis frame */ data anno_white; length function color $8 style $15; when='b'; style='solid'; color='white'; xsys='1'; ysys='1'; function='move'; x=0; y=0; output; function='bar'; x=100; y=100; output; run; data anno_means; set anno_white anno_means; run; /* These are mostly just hard-coded in this proof-of-concept. In the real/production version, these should be calculated, and the values stored in macro variables, and then the macro variables used here, instead of the hard-coded values. */ data anno_table; length color $8 text $50 style $15; xsys='3'; ysys='3'; hsys='3'; function='label'; size=2.0; y=26; color="&textcolor"; style='"arial/bold"'; position='5'; x=33; text='Annualized Return'; output; x=58; text='Standard Deviation'; output; x=83; text='Sharpe Ratio'; output; y=23; color="&textcolor"; style='"arial/bold"'; position='4'; x=30; text='Value'; output; x=40; text='Rank'; output; x=55; text='Value'; output; x=65; text='Rank'; output; x=80; text='Value'; output; x=90; text='Rank'; output; y=20; color='blue'; style='marker'; position='5'; x=3; text='V'; output; color="&textcolor"; style='"arial"'; position='6'; x=5; text='MGR COMPOSITE'; output; position='4'; x=30; text='-6.6'; output; x=40; text='71'; output; x=55; text='9.9'; output; x=65; text='52'; output; x=80; text='-1.0'; output; x=90; text='_'; output; y=17; color='blue'; style='marker'; position='5'; x=3; text='U'; output; color="&textcolor"; style='"arial"'; position='6'; x=5; text='ALLOC INDEX'; output; position='4'; x=30; text='-6.7'; output; x=40; text='71'; output; x=55; text='8.9'; output; x=65; text='62'; output; x=80; text='-1.1'; output; x=90; text='_'; output; y=14; color='blue'; style='marker'; position='5'; x=3; text='A'; output; color="&textcolor"; style='"arial"'; position='6'; x=5; text='POLICY INDEX'; output; position='4'; x=30; text='-7.7'; output; x=40; text='80'; output; x=55; text='10.5'; output; x=65; text='40'; output; x=80; text='-1.0'; output; x=90; text='_'; output; y=11; color='blue'; style='special'; position='5'; x=3; text='.'; output; color="&textcolor"; style='"arial"'; position='6'; x=5; text='S&P 500'; output; position='4'; x=30; text='-16.1'; output; x=40; text='98'; output; x=55; text='17.8'; output; x=65; text='4'; output; x=80; text='-1.1'; output; x=90; text='_'; output; y=8; color='blue'; style='special'; position='5'; x=3; text='o'; output; color="&textcolor"; style='"arial"'; position='6'; x=5; text='LB AGGREGATE'; output; position='4'; x=30; text='9.8'; output; x=40; text='1'; output; x=55; text='3.3'; output; x=65; text='88'; output; x=80; text='1.8'; output; x=90; text='1'; output; y=4; color="&textcolor"; style='"arial"'; position='6'; x=5; text='MEAN'; output; position='4'; x=30; text=trim(left(put(&mean_return,comma5.1))); output; x=55; text=trim(left(put(&mean_risk,comma5.1))); output; x=80; text='0.8'; output; run; %include 'gradient.sas'; data anno_means; set anno_gradient anno_means; run; GOPTIONS DEVICE=gif; goptions xpixels=800 ypixels=700; ODS LISTING CLOSE; ODS HTML path=odsout body="&name..htm" (title="Return -vs- Risk Plot") style=minimal gtitle gfootnote ; goptions border; goptions gunit=pct htitle=4 ftitle="arial/bold" htext=2.5 ftext="arial" ctitle=cx4f584a ctext=cx4f584a; axis1 order=(-20 to 10 by 10) label=(a=90 font="arial/bold" 'Annualized Rate of Return') value=(height=2.2) minor=none offset=(3,3); axis2 order=(1 to 18 by 1) label=(font="arial/bold" 'Historical Standard Deviation of Return (Risk)') value=(height=2.2) minor=none offset=(3,3); symbol1 value=dot color=black height=.25; symbol2 color=blue height=2.2 font=marker value="V"; symbol3 color=blue height=2.2 font=marker value="U"; symbol4 color=blue height=2.2 font=marker value="A"; symbol5 color=blue height=2.2 font=special value="."; symbol6 color=blue height=2.2 font=special value="o"; title1 link="http://www.sas.com" "FUND SAMPLE REPORT"; title2 font="arial/bold" "Total Funds - Total Returns vs Risk"; title3 font="arial/bold" "3 Years Ending 3/05"; title4 a=90 h=2pct " "; title5 a=-90 h=4pct " "; footnote1 h=27pct " "; goptions cback=white; proc gplot data=mydata anno=anno_means; plot return*risk=symbol / vaxis=axis1 haxis=axis2 href=&mean_risk chref=red vref=&mean_return cvref=red nolegend anno=anno_table cframe=white html=myhtml des="" name="&name" ; run; quit; ODS HTML CLOSE; ODS LISTING;