%let name=sas_golf_championship; /* Set your current-working-directory (to read/write files), if you need to ... %let rc=%sysfunc(dlgcdir('c:\someplace\public_html')); */ filename odsout '.'; /* Using data from: https://www.pgatour.com/champions/tournaments/sas-championship/past-results.2018.html */ libname here '.'; /* */ data sas_championship_data; run; %macro readdata(year); filename tempfile "sas_golf_championship_&year..txt"; data temp; length player $100 pos_char $10; informat official_money dollar20.2; format official_money dollar20.0; infile tempfile lrecl=250 pad firstobs=1 dlm='09'x; input player pos_char round1 round2 round3 total_score official_money; year=.; year=&year; pos=.; pos=scan(pos_char,-1,'T'); length pointlabel $50; if pos=1 then pointlabel='a0a0'x||trim(left(scan(player,-1,' '))); run; data temp; set temp; original_order=_n_; run; data sas_championship_data; set sas_championship_data temp; run; %mend; %readdata(2018); %readdata(2017); %readdata(2016); %readdata(2015); %readdata(2014); %readdata(2013); %readdata(2012); %readdata(2011); %readdata(2010); %readdata(2009); %readdata(2008); %readdata(2007); *%readdata(2006); %readdata(2005); %readdata(2004); %readdata(2003); %readdata(2002); %readdata(2001); data sas_championship_data; set sas_championship_data (where=(round1^=. and round2^=. and round3^=. and total_score^=.)); run; data here.sas_championship_data; set sas_championship_data; run; data my_data; set here.sas_championship_data; run; ODS LISTING CLOSE; ODS HTML path=odsout body="&name..htm" (title="SAS Golf Championship") style=htmlblue; ods graphics / noscale /* if you don't use this option, the text will be resized */ imagemap tipmax=2500 imagefmt=png imagename="&name" width=800px height=600px noborder; title1 c=gray33 h=18pt "SAS Championship Golf Scores (3 round totals)"; title2 h=5pt 'a0'x; proc sgplot data=my_data; scatter x=year y=total_score; run; ods escapechar='^'; proc sgplot data=my_data noborder; scatter x=year y=total_score / markerattrs=(color=blue) tip=(year total_score pos_char player); yaxis display=(noline noticks) label="^{unicode '2190'x} Worse Better ^{unicode '2192'x}" offsetmin=0 offsetmax=0 grid gridattrs=(pattern=dot color=gray88) values=(190 to 260 by 10) reverse; xaxis display=(nolabel noline noticks) offsetmin=0 offsetmax=0 values=(2000 to 2020 by 5); refline 2000 to 2020 by 1 / axis=x lineattrs=(color=gray88 thickness=1px pattern=dot); run; proc sgplot data=my_data noautolegend noborder; scatter x=year y=total_score / markerattrs=(color=blue) tip=(year total_score pos_char player) ; vbox total_score / category=year fillattrs=(color=red transparency=.5); yaxis display=(noline noticks) label="^{unicode '2190'x} Worse Better ^{unicode '2192'x}" offsetmin=0 offsetmax=0 grid gridattrs=(pattern=dot color=gray88) values=(190 to 260 by 10) reverse; xaxis display=(nolabel noline noticks) offsetmin=0 offsetmax=0 values=(2000 to 2020 by 5); refline 2000 to 2020 by 1 / axis=x lineattrs=(color=gray88 thickness=1px pattern=dot); run; proc sgplot data=my_data noborder; scatter x=year y=total_score / jitter tip=(year total_score pos_char player) markerattrs=(color=blue); yaxis display=(noline noticks) label="^{unicode '2190'x} Worse Better ^{unicode '2192'x}" offsetmin=0 offsetmax=0 grid gridattrs=(pattern=dot color=gray88) values=(190 to 260 by 10) reverse; xaxis display=(nolabel noline noticks) offsetmin=0 offsetmax=0 values=(2000 to 2020 by 5); refline 2000 to 2020 by 1 / axis=x lineattrs=(color=gray88 thickness=1px pattern=dot); run; proc sgplot data=my_data noborder; scatter x=year y=total_score / markerattrs=(color=blue) jitter=uniform tip=(year total_score pos_char player); yaxis display=(noline noticks) label="^{unicode '2190'x} Worse Better ^{unicode '2192'x}" offsetmin=0 offsetmax=0 grid gridattrs=(pattern=dot color=gray88) values=(190 to 260 by 10) reverse; xaxis display=(nolabel noline noticks) type=discrete offsetmin=0 offsetmax=0 values=(2000 to 2020 by 1) valuesdisplay=( '2000' ' ' ' ' ' ' ' ' '2005' ' ' ' ' ' ' ' ' '2010' ' ' ' ' ' ' ' ' '2015' ' ' ' ' ' ' ' ' '2020' ); refline 2000 to 2020 by 1 / axis=x lineattrs=(color=gray88 thickness=1px pattern=dot); run; /* proc print data=my_data (obs=10); run; */ quit; ODS HTML CLOSE; ODS LISTING;