Monday, January 14, 2013
SAS and D3.js (3): draw a map to display US cities' murder rates
Robert Allison has given an excellent map example by SAS/GRAPH about the murder rates per 100,000 people in the major US cities. To emulate this map, we should annotate the cities and use the size of the bubbles to represent the murder rates.
1. Input raw data and transform SAS d to JSON
I only choose the top 20 most violent cities, since I have to manually enter the coordinates data including longitude and latitude. Then I transform them to JSON format. To label all cities from the EXCEL file, a better way is to use R's ggmap package to automate the process of fetching the coordinates.
2. Draw the map and label the cities
D3.js provides the basic us-states.json data. The only thing that needs to do is to attache the cities' murder rate data to the HTML codes. A modern browser such as Chrome will compile the codes and generate the physical map.
As a formal statistician and a current engineer, I feel that a successful engineering project may require both the mathematician’s abilit...
ABSTRACT PROC SQL is not only one of the many SAS procedures and also a distinctive subsystem with all common features from SQL (Stru...
This is a following post after my previous post about SAS/SQL. SAS’s SQL procedure has a basic SQL syntax. I found that the most challe...
The Hadoop system has its unique shell language, which is called FS . Comparing with the common Bash shell within the Linux ecosystem, the...