These days many devices (such as smart phone apps, Fitbits, Apple watches, dog tracking collars, car gps, hiking gps, teen/car trackers, etc) can track your location, and provide you with standard/canned ways to analyze the data. This blog post shows how I created a custom SAS map of the tracking data for my recent trip to Cuba. Hopefully this will inspire and help teach you to create your own custom maps!
Before we get into the nitty gritty data analysis, here are a few pictures I took in Cuba...
And now, back to the data analysis!...
For our trip (kayaking the 100+ miles from Cuba to the US), we used a special tracking device called a SPOT (on loan from my good buddy Mark - thanks Mark!). This device tracked our position, and relayed the coordinates directly to a satellite every ~10 minutes, so our friends, family, and fans could monitor our progress on SPOT's Web page. Here's a screen capture of their map:
The SPOT map was very useful for interactive/instantaneous tracking - it lets you pan & zoom, and view the map or a satellite image, and you can view the data points 50 at a time. But I wanted something a little different...
So I had my buddy Mark download the data in csv format, so I could do my own analysis. Here's how the csv data was structured:
And here is the code I used to import the data into SAS:
PROC IMPORT DATAFILE="cuba_crossing_spot_data.csv" OUT=anno_path (rename=(var1=date_time var4=lat var5=long)) DBMS=CSV REPLACE; GETNAMES=NO; RUN;
I used the lag() function in combination with the geodist() function to calculate the distance between each successive data location reading, and I used a data step to calculate the running total miles. I added some extra variables to the dataset so it could be used to annotate markers on the map, and added html hover-text so you can the timestamp and distance for each marker. Below is a snapshot of the map - click it to see the interactive version with html hover-text:
There are a few other things I added that are also worth mentioning. The lat/long grid lines are created programmatically in a data step, and annotated on the map. I have labeled certain cities and landmarks based on their lat/long values, with the location of the label determined by an x/y offset. The landmark labels have html drill down links to the google map zoomed in to that location. And I use Proc Sql to grab the maximum distance (117.7 miles) and stuff it into a macro variable, so I can use it in the title.
It's a nice little example that shows how to add a lot of things to a map. Here's the code, if you'd like to download it and try running & modifying it.
So ... what sort of tracking data might you have, and what kind of custom analysis would you like to do with it using SAS?!?