Tuesday, December 6, 2011

A new way to draw maps in SAS


SAS’s ODS Graphics technology brought the concept of layer into data visualization. We can use those SG procedures to do many tricks. Previously in SAS, a map has to be drawn from its GMAP procedure. Now we can simply use 3-4 lines of codes to sketch some maps by the scatter statement in PROC SGPLOT, such as North America or Asia.

ods html style = money;
proc sgplot data = maps.namerica noautolegend;
 scatter x = x y = y / group = id  markerattrs=(size=1);
 xaxis grid label = ' '; yaxis grid label = ' ';
run;
proc sgplot data = maps.china ;
 scatter x = x y = y /markerattrs=(size=2);
 xaxis grid label = ' '; yaxis grid label = ' ';
run;



We can apply it to single countries, like China or India. For India, the aspect has to be modified a little. It can be aslo done by PROC SGSCATTER. My friend Xiangxiang has a great tutorial for this procedure.

ods html style = harvest;
proc sgplot data = maps.asia noautolegend;
 scatter x = x y = y / group = id  markerattrs=(size=1);
 xaxis grid label = ' '; yaxis grid label = ' ';
run;

ods html style = htmlbluecml;
ods graphics on / width=6in height = 6in;
proc sgplot data = maps.india;
 scatter x = x y = y /markerattrs=(size=2);
 xaxis grid label = ' '; yaxis grid label = ' ';
run;
ods graphics  / reset;
Thanks to SAS’s ODS group, those SG procedures always give me limitless fun

Good math, bad engineering

As a formal statistician and a current engineer, I feel that a successful engineering project may require both the mathematician’s abilit...