|
楼主

楼主 |
发表于 2011-12-7 10:38:11
|
只看该作者
A new way to draw maps in SAS
From Dapangmao's blog on sas-analysis
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/-DtsQ6-J3WpQ/Tt7OngohQSI/AAAAAAAAA3o/JkKHGJus0oA/s1600/SGPlot.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="300" src="http://4.bp.blogspot.com/-DtsQ6-J3WpQ/Tt7OngohQSI/AAAAAAAAA3o/JkKHGJus0oA/s400/SGPlot.png" width="400" /></a></div><br />
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 <a href="http://support.sas.com/documentation/cdl/en/graphref/63022/HTML/default/viewer.htm#gmap-proc-statement.htm">its GMAP procedure</a>. 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. <br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/-SsPeeDVc2jE/Tt7OylMr1PI/AAAAAAAAA30/8sLbHEsEb3U/s1600/SGPlot1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="300" src="http://2.bp.blogspot.com/-SsPeeDVc2jE/Tt7OylMr1PI/AAAAAAAAA30/8sLbHEsEb3U/s400/SGPlot1.png" width="400" /></a></div><br />
<pre style="background-color: #ebebeb; border: 1px dashed rgb(153, 153, 153); color: #000001; font-size: 14px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"><code>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;
</code></pre><div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/-8vEy8sQRK5U/Tt7O4v0_qnI/AAAAAAAAA4A/uCWtFNMkqHA/s1600/SGPlot2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="300" src="http://2.bp.blogspot.com/-8vEy8sQRK5U/Tt7O4v0_qnI/AAAAAAAAA4A/uCWtFNMkqHA/s400/SGPlot2.png" width="400" /></a></div><br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/-H-phdsYI4lg/Tt7O9WLD7vI/AAAAAAAAA4M/u7530ZSl3M0/s1600/SGPlot4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="http://1.bp.blogspot.com/-H-phdsYI4lg/Tt7O9WLD7vI/AAAAAAAAA4M/u7530ZSl3M0/s400/SGPlot4.png" width="400" /></a></div><br />
<br />
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<a href="http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CB8QFjAA&url=http%3A%2F%2Fsupport.sas.com%2Fresources%2Fpapers%2Fproceedings10%2F057-2010.pdf&ei=Es_eTtzBE6r4sQL7pZimBw&usg=AFQjCNHFRyrPhn6oUXgmugPWm2tmAPYXpw&sig2=2jAblgXHy_o6CwvH3HsEvg"> tutorial</a> for this procedure. <br />
<pre style="background-color: #ebebeb; border: 1px dashed rgb(153, 153, 153); color: #000001; font-size: 14px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"><code>
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;
</code></pre>Thanks to SAS’s ODS group, those SG procedures always give me limitless fun<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3256159328630041416-4317076571577001891?l=www.sasanalysis.com' alt='' /></div><img src="http://feeds.feedburner.com/~r/SasAnalysis/~4/VX7SW81ORU0" height="1" width="1"/> |
|