%let start = '01jan2013'd; %let stop = '09Nov2013'd; /* can be today() for ongoing runs */ data runs; input d $ Distance @@; Date = input(trim(d) || '/13', mmddyy8.); TotalMiles + distance; datalines; 1/1 7.6 1/3 7.6 1/5 10.4 1/7 7.6 1/9 7.6 1/13 10.4 1/24 7.6 1/28 10.4 1/30 7.6 2/1 7.6 2/3 12.2 2/5 7.6 2/10 7.6 2/12 8.2 2/14 8.2 2/16 13.1 2/19 8.2 2/21 8.2 2/24 10.4 2/26 7.6 2/28 8.2 3/2 13.65 3/4 8.2 3/6 8.2 3/8 13.9 3/10 10.4 3/12 8.2 3/14 8.2 3/16 8.2 3/17 5.2 3/19 8.2 3/21 8.2 3/23 8.2 3/27 8.2 3/28 5.2 3/30 13.9 4/1 5.2 4/3 8.2 4/5 5.2 4/6 10.4 4/8 8.2 4/10 8.2 4/11 5.2 4/13 10.4 4/15 8.2 4/17 5.2 4/20 8.2 4/22 8.2 4/24 8.2 4/26 8.2 4/27 3 4/28 4 4/29 4.25 4/30 5.2 5/1 4.1 5/2 4.1 5/4 8.2 5/6 5.2 5/7 8.2 5/9 5.2 5/11 10.4 5/13 4.35 5/14 4.25 5/15 4.25 5/22 5.2 5/25 10.4 5/27 10.4 5/29 10.4 5/31 13.9 6/2 10.4 6/4 10.4 6/6 10.4 6/8 10.4 6/9 10.4 6/11 10.4 6/15 8.2 6/19 5.2 6/23 10.4 6/25 8.2 6/26 5.2 6/28 15 6/30 11.2 7/2 3 7/3 8.2 7/5 8.2 7/6 8.2 7/7 8.2 7/9 8.2 7/10 8.2 7/12 16 7/15 8.2 7/16 8.2 7/17 5.2 7/19 14 7/20 8.2 7/22 8.2 7/23 5.2 7/24 10.4 7/26 8.2 7/28 4.1 7/29 6.3 7/30 10.4 7/31 8.2 8/3 11.9 8/4 4.5 8/5 5 8/6 6.1 8/7 4.2 8/9 5.2 8/10 4 8/11 12 8/13 5.2 8/16 5.2 8/17 10.4 8/18 8.2 8/19 5.2 8/20 5.2 8/21 8.2 8/23 5.4 8/27 5.2 8/28 5.2 8/29 3 9/1 5.2 9/3 5.2 9/4 8.2 9/5 10.4 9/6 5.2 9/7 5.2 9/8 8.9 9/9 7 9/12 5.2 9/14 18 9/17 5.2 9/18 10.4 9/19 5.2 9/20 6.75 9/21 10.4 9/23 8.2 9/24 8.2 9/27 8.2 9/28 20 10/2 5.2 10/3 8.2 10/4 5.2 10/5 14 10/8 9.8 10/10 10 10/11 5.2 10/13 20 10/15 8.2 10/16 5.2 10/17 8.2 10/22 21.3 10/24 8 10/25 5.2 10/26 14 10/30 5.2 10/31 5.2 11/1 5.2 11/2 10.4 11/5 3.1 11/7 3.1 11/9 27.36 ; data all; Distance = 0; do Date = &start to &stop; output; end; run; data r2; update all runs(in=r); by date; g = scan("Run Rest", 2 - r); if distance ge 26.2 then star = distance; x = date - &start; run; proc reg data=r2 noprint; model totalmiles = x / noint; output p=pred out=r; run; proc sgplot data=r; title "Warren's 2013 Runs"; refline %sysevalf(1500 / 365); series y=pred x=date / y2axis lineattrs=graphreference; step y=totalmiles x=date / y2axis lineattrs=graphdata3 name='t' legendlabel='Total Miles'; pbspline y=distance x=date / nomarkers name='p' legendlabel='Miles Per Day'; scatter y=distance x=date / group=g markerattrs=(size=5px symbol=circlefilled) name='r'; scatter y=star x=date / markerattrs=(size=15px symbol=star) legendlabel='Marathon' name='s'; format date mmddyy8.; xaxis display=(nolabel); y2axis max=1500 labelattrs=graphdata3 valueattrs=graphdata3 label='Total Miles'; keylegend 'r' 's' 'p' 't' / location=inside position=topleft across=1; run; title;