%let name=us_weekly_mortgage_rate; /* Set your current-working-directory (to read/write files), if you need to ... %let rc=%sysfunc(dlgcdir('c:\someplace\public_html')); */ filename odsout '.'; /* Similar to graphs in this post by Opril Orr: https://twitter.com/aprilaorr/status/1088832775254392833 Using data from: http://www.freddiemac.com/pmms/ historicalweeklydata.xls */ proc import datafile="../ods4/historicalweeklydata.xls" dbms=xls out=historical_data; range='Full History$a8:b0'; getnames=no; run; proc import datafile="../ods4/historicalweeklydata.xls" dbms=xls out=data_2019; range='1PMMS2019$a8:b22'; getnames=no; run; data my_data; set historical_data (rename=(a=date b=rate)) data_2019 (rename=(a=date b=rate)); year=.; year=year(date); day_of_year=.; day_of_year=put(date,julday.); year_color=.; year_color=mod(year,10); rate=rate/100; run; ODS LISTING CLOSE; ODS HTML path=odsout body="&name..htm" (title="U.S. Weekly Mortgage Rate") style=htmlblue; ods graphics / noscale /* if you don't use this option, the text will be resized */ attrpriority=none /* so the plot marker shapes will rotate */ imagemap tipmax=25000 imagefmt=png imagename="&name" width=800px height=450px noborder; title1 c=gray33 h=16pt "U.S. 30-Year Residential Mortgage Rate"; footnote c=gray77 h=10pt "Data source: Freddie Mac Primary Mortgage Marker Survey (weekly data through April 11, 2019)"; proc sgplot data=my_data (where=(year>=2016)) noautolegend; format rate percent7.1; /* format day_of_year monname3.; */ format day_of_year comma7.0; /* non-date numeric, so I can use valuesdisplay */ styleattrs datacontrastcolors=(cxfd01f2 cx61B329 cx0000ff red) datalinepatterns=(solid solid solid solid) datasymbols=(circle triangle square circlefilled); series x=day_of_year y=rate / group=year markers tip=(date rate) tiplabel=('Date' 'Rate') tipformat=(date9. auto) curvelabel curvelabelpos=end; yaxis display=(nolabel noticks) values=(.032 to .053 by .003) valueattrs=(color=gray33 size=10pt) offsetmin=0 offsetmax=0 grid gridattrs=(pattern=dot color=gray88) ; xaxis display=(nolabel noticks) values=('01jan1960'd to '01jan1961'd by month) valueattrs=(color=gray33 size=10pt) valuesdisplay=( 'Jan' 'Feb' 'Mar' 'Apr' 'May' 'Jun' 'Jul' 'Aug' 'Sep' 'Oct' 'Nov' 'Dec' ' ') offsetmin=0 grid gridattrs=(pattern=dot color=gray88) ; run; quit; ODS HTML CLOSE; ODS LISTING;