%let name=robs_race; filename odsout '.'; /* playing around with some Garmin sports gps data, from my oc1 practices & race */ data my_data; run; %macro readdata(dataname); options NOQUOTELENMAX; filename temp_url "&dataname..tcx"; data &dataname (drop = next_record timestamp_string junk); length next_record $300 timestamp_string $26 junk $1 event $20; format latitude longitude comma20.16; infile temp_url /*lrecl=1073741823*/ lrecl=1000000 dlm="" pad; input next_record @@; if next_record='Time' then do; input timestamp_string @@; format timestamp datetime.; timestamp=input(substr(timestamp_string,1,23),E8601DT23.3); input junk @@; input junk @@; input junk @@; input junk @@; input junk @@; input junk @@; input junk @@; input latitude @@; input junk @@; input junk @@; input junk @@; input junk @@; input longitude @@; input junk @@; input junk @@; input junk @@; input junk @@; input junk @@; input junk @@; input junk @@; input junk @@; input junk @@; input junk @@; input junk @@; input junk @@; input distance_meters @@; event=propcase(translate("&dataname",'','_')); output; end; run; data &dataname; set &dataname; retain start_time; if _n_=1 then start_time=timestamp; format elapsed_seconds time5.; elapsed_seconds=timestamp-start_time; run; data my_data; set my_data &dataname; distance_miles=distance_meters*0.000621371; if latitude^=. then output; run; %mend; %readdata(practice_1); %readdata(practice_2); %readdata(practice_3); %readdata(practice_4); %readdata(race); /* I paused the gps for a few minutes to go to my car and change paddles, so let's subtract that time out ... */ data my_data; set my_data; if event='Practice 4' and elapsed_seconds>'00:30't then elapsed_seconds=elapsed_seconds-'00:08't; if event='Race' and elapsed_seconds>'01:50't then delete; run; goptions device=png; goptions noborder; ODS LISTING CLOSE; ODS HTML path=odsout body="&name..htm" (title="OC1 practices & Indojax race") style=sasweb; goptions gunit=pct ftitle='albany amt/bold' ftext='albany amt' htitle=15pt htext=11pt; goptions ctext=gray33; symbol1 value=none interpol=join color=blue; symbol2 value=none interpol=join color=green; symbol3 value=none interpol=join color=orange; symbol4 value=none interpol=join color=purple; symbol5 value=none interpol=join width=2 color=red; axis1 label=('Miles') style=0 major=none minor=none offset=(0,0); axis2 label=('Time') style=0 major=none minor=none offset=(0,0); legend1 label=none position=(top center); title1 ls=1.5 "Robert's OC1 practices & IndoJax race on March 25, 2017"; proc gplot data=my_data; plot distance_miles*elapsed_seconds=event / legend=legend1 vaxis=axis1 haxis=axis2 noframe autohref chref=graydd autovref cvref=graydd des='' name="&name"; run; quit; ODS HTML CLOSE; ODS LISTING;