Wednesday, January 9, 2013
SAS and D3.js (1): a macro to draw scatter plot
HTML is the default output format for SAS since 9.3. Implementing the popular JavaScipt frameworks such as jQuery and D3.js will allow some dynamic effects to the final HTML results. In those cases the HTML file is static, and thus no HTTP server is needed.
At the beginning, I come up with a simple SAS macro to realize the scatter plot which is a SVG format picture on the canvas of a HTML page.
1. Transform SAS dataset to JSON
JSON is the dominant data format for web. Actually I found that SAS’s dataset can be easily transformed to JSON . Here the SASHELP.CLASS dataset is transformed to JSON by two consecutive DATA STEPs. Of course, a macro can be a beter way to simplify those steps, like Wade Buskirk's JSON.sas.
2. Draw the scatterplot
Finally the scatter plot is drawn on the generated HTML file. D3.js is the future of data visualization. Playing SAS and D3 brings me a lot of fun.
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...