SAS中文论坛
标题:
SAS EM:Multiplot node(绘图结点)
[打印本页]
作者:
shiyiming
时间:
2010-10-22 22:51
标题:
SAS EM:Multiplot node(绘图结点)
From supersasmacro's blog on Sina
<div>SAS EM:Multiplot node(绘图结点)</DIV>
<div><br /></DIV>
<div>SAS EM(Enterprise Miner)企业数据挖掘节点功能详解及代码实现(第三弹)</DIV>
<div><br /></DIV>
<div>本文未经作者允许,请勿转载</DIV>
<div><br /></DIV>
<div>
绘图节点是一个可视化工具,帮助用户在大量数据中找到数据的形态。可批量生成直方图和散布图,并可以做回归及平滑直方图从布了解数据的分布情况。它和分布浏览器节点不同的是―它会从数据集合中的输入和目标变量自动的绘制图表,而图表的种类有:直方图(Bar
Charts)和散布图(Scatter Plots)等。另外,它还会预设的绘制一条在90%信赖区间内的回归线。</DIV>
<div><br /></DIV>
<div>对于Multiplot node(绘图结点):</DIV>
<div> <a href="http://blog.photo.sina.com.cn/showpic.html#url=http://static6.photo.sina.com.cn/orignal/5d3b177cg8b8b4244e595" TARGET="_blank"><img SRC="http://static6.photo.sina.com.cn/middle/5d3b177cg8b8b4244e595&690" WIDTH="500" HEIGHT="300" /></A></DIV>
<br />
<div>首先设置字体:</DIV>
<div> <a href="http://blog.photo.sina.com.cn/showpic.html#url=http://static8.photo.sina.com.cn/orignal/5d3b177cg8b8b45bb0527" TARGET="_blank"><img SRC="http://static8.photo.sina.com.cn/middle/5d3b177cg8b8b45bb0527&690" WIDTH="425" HEIGHT="239" /></A></DIV>
<br />
<div>代码:</DIV>
<div>data EMDATA.VIEW_4O9 / view=EMDATA.VIEW_4O9;</DIV>
<div> set EMSAMPLE.BUYTEST;</DIV>
<div>run;</DIV>
<div>goptions ftext=SWISS; ** 字体为SWISS;</DIV>
<div>设置图形元素:这里,我们选择画直方图</DIV>
<div> <a href="http://blog.photo.sina.com.cn/showpic.html#url=http://static3.photo.sina.com.cn/orignal/5d3b177cg8b8b46df6d32" TARGET="_blank"><img SRC="http://static3.photo.sina.com.cn/middle/5d3b177cg8b8b46df6d32&690" /></A></DIV>
<br />
<div>代码:</DIV>
<div>goptions nodisplay device=WIN htext=3 pct; **字体高度;</DIV>
<div>axis1 width=2 offset=(1,1) label=(height=4 pct rotate=90
angle=270) minor=none; **设置横轴;</DIV>
<div>axis2 width=2 label=(height=4 pct) minor=none; **设置纵轴;</DIV>
<div>pattern1 value= solid; **设置图形;</DIV>
<div><br /></DIV>
<div>作图变量选择:</DIV>
<div> <a href="http://blog.photo.sina.com.cn/showpic.html#url=http://static8.photo.sina.com.cn/orignal/5d3b177cg8b8b4856c4d7" TARGET="_blank"><img SRC="http://static8.photo.sina.com.cn/middle/5d3b177cg8b8b4856c4d7&690" /></A></DIV>
<br />
<div>代码:</DIV>
<div>proc gchart data= EMDATA.VIEW_4O9 </DIV>
<div>
gout= EMPROJ.DMT9GE74; **图形输出设置;</DIV>
<div> title
height=6 pct "RESPOND"; **标题设置;</DIV>
<div> vbar
RESPOND / name= "RESPOND" description=
"RESPOND" </DIV>
<div>
freq type=
freq </DIV>
<div>
noframe
missing </DIV>
<div>
discrete raxis=axis1
maxis=axis2;
*图形设置:包括直方图为横向还是纵向,是否包括缺失值,按频度还是按百分比,等等;</DIV>
<div>run; </DIV>
<div><br /></DIV>
<div>*以下的设置与上面的作用完全一样,只是是针对不同的变量画直方图。在实际写代码的时候,我们可以用宏来实现;</DIV>
<div> title
height=6 pct "AGE"; </DIV>
<div> vbar
AGE / name= "AGE" description= "AGE" </DIV>
<div>
freq type=
freq </DIV>
<div>
noframe
missing </DIV>
<div>
raxis=axis1
maxis=axis2; </DIV>
<div>run; </DIV>
<div> title
height=6 pct "INCOME"; </DIV>
<div> vbar
INCOME / name= "INCOME" description=
"INCOME" </DIV>
<div>
freq type= freq </DIV>
<div>
noframe missing </DIV>
<div>
raxis=axis1 maxis=axis2; </DIV>
<div>run; </DIV>
<div> title
height=6 pct "SEX"; </DIV>
<div> vbar
SEX / name= "SEX" description= "SEX" </DIV>
<div>
freq type=
freq </DIV>
<div>
noframe
missing </DIV>
<div>
raxis=axis1
maxis=axis2; </DIV>
<div>run; </DIV>
<div> title
height=6 pct "MARRIED"; </DIV>
<div> vbar
MARRIED / name= "MARRIED" description=
"MARRIED" </DIV>
<div>
freq type=
freq </DIV>
<div>
noframe
missing </DIV>
<div>
discrete </DIV>
<div>
raxis=axis1
maxis=axis2; </DIV>
<div>run; </DIV>
<div> title
height=6 pct "FICO"; </DIV>
<div> vbar
FICO / name= "FICO" description= "FICO" </DIV>
<div>
freq type=
freq </DIV>
<div>
noframe
missing </DIV>
<div>
raxis=axis1 maxis=axis2; </DIV>
<div>run; </DIV>
<div> title
height=6 pct "OWNHOME"; </DIV>
<div> vbar
OWNHOME / name= "OWNHOME" description=
"OWNHOME" </DIV>
<div>
freq type=
freq </DIV>
<div>
noframe
missing </DIV>
<div>
discrete </DIV>
<div>
raxis=axis1
maxis=axis2; </DIV>
<div>run; </DIV>
<div> title
height=6 pct "LOC"; </DIV>
<div> vbar
LOC / name= "LOC" description= "LOC" </DIV>
<div>
freq type=
freq </DIV>
<div>
noframe
missing </DIV>
<div>
raxis=axis1
maxis=axis2; </DIV>
<div>run; </DIV>
<div> title
height=6 pct "CLIMATE"; </DIV>
<div> vbar
CLIMATE / name= "CLIMATE" description=
"CLIMATE" </DIV>
<div>
freq type=
freq </DIV>
<div>
noframe
missing </DIV>
<div>
raxis=axis1
maxis=axis2; </DIV>
<div>run; </DIV>
<div> title
height=6 pct "BUY6"; </DIV>
<div> vbar
BUY6 / name= "BUY6" description= "BUY6" </DIV>
<div>
freq type=
freq </DIV>
<div>
noframe
missing </DIV>
<div>
discrete </DIV>
<div>
raxis=axis1 maxis=axis2; </DIV>
<div>run; </DIV>
<div> title
height=6 pct "BUY12"; </DIV>
<div> vbar
BUY12 / name= "BUY12" description= "BUY12" </DIV>
<div>
freq type= freq </DIV>
<div>
noframe missing </DIV>
<div>
discrete </DIV>
<div>
raxis=axis1 maxis=axis2; </DIV>
<div>run; </DIV>
<div> title
height=6 pct "BUY18"; </DIV>
<div> vbar
BUY18 / name= "BUY18" description= "BUY18" </DIV>
<div>
freq type= freq </DIV>
<div>
noframe missing </DIV>
<div>
discrete </DIV>
<div>
raxis=axis1 maxis=axis2; </DIV>
<div>run; </DIV>
<div> title
height=6 pct "VALUE24"; </DIV>
<div> vbar
VALUE24 / name= "VALUE24" description=
"VALUE24" </DIV>
<div>
freq type=
freq </DIV>
<div>
noframe
missing </DIV>
<div>
raxis=axis1
maxis=axis2; </DIV>
<div>run; </DIV>
<div> title
height=6 pct "ORGSRC"; </DIV>
<div> vbar
ORGSRC / name= "ORGSRC" description=
"ORGSRC" </DIV>
<div>
freq type= freq </DIV>
<div>
noframe missing </DIV>
<div>
raxis=axis1 maxis=axis2; </DIV>
<div>run; </DIV>
<div> title
height=6 pct "DISCBUY"; </DIV>
<div> vbar
DISCBUY / name= "DISCBUY" description=
"DISCBUY" </DIV>
<div>
freq type=
freq </DIV>
<div>
noframe
missing </DIV>
<div>
discrete </DIV>
<div>
raxis=axis1
maxis=axis2; </DIV>
<div>run; </DIV>
<div> title
height=6 pct "RETURN24"; </DIV>
<div> vbar
RETURN24 /name= "RETURN24" description=
"RETURN24" </DIV>
<div>
freq type=
freq </DIV>
<div>
noframe
missing </DIV>
<div>
discrete </DIV>
<div>
raxis=axis1
maxis=axis2; </DIV>
<div>run; </DIV>
<div> title
height=6 pct "COA6"; </DIV>
<div> vbar
COA6 / name= "COA6" description= "COA6" </DIV>
<div>
freq type=
freq </DIV>
<div>
noframe
missing </DIV>
<div>
discrete </DIV>
<div>
raxis=axis1 maxis=axis2; </DIV>
<div>run; </DIV>
<div> title
height=6 pct "C1"; </DIV>
<div> vbar
C1 / name= "C1" description= "C1" </DIV>
<div>
freq type=
freq </DIV>
<div>
noframe
missing </DIV>
<div>
discrete </DIV>
<div>
raxis=axis1
maxis=axis2; </DIV>
<div>run; </DIV>
<div> title
height=6 pct "C2"; </DIV>
<div> vbar
C2 / name= "C2" description= "C2" </DIV>
<div>
freq type=
freq </DIV>
<div>
noframe
missing </DIV>
<div>
raxis=axis1
maxis=axis2; </DIV>
<div>run; </DIV>
<div> title
height=6 pct "C3"; </DIV>
<div> vbar
C3 / name= "C3" description= "C3" </DIV>
<div>
freq type=
freq </DIV>
<div>
noframe
missing </DIV>
<div>
raxis=axis1
maxis=axis2; </DIV>
<div>run; </DIV>
<div> title
height=6 pct "C4"; </DIV>
<div> vbar
C4 / name= "C4" description= "C4" </DIV>
<div>
freq type=
freq </DIV>
<div>
noframe
missing </DIV>
<div>
raxis=axis1
maxis=axis2; </DIV>
<div>run; </DIV>
<div> title
height=6 pct "C5"; </DIV>
<div> vbar
C5 / name= "C5" description= "C5" </DIV>
<div>
freq type=
freq </DIV>
<div>
noframe
missing </DIV>
<div>
raxis=axis1
maxis=axis2; </DIV>
<div>run; </DIV>
<div> title
height=6 pct "C6"; </DIV>
<div> vbar
C6 / name= "C6" description= "C6" </DIV>
<div>
freq type=
freq </DIV>
<div>
noframe
missing </DIV>
<div>
raxis=axis1
maxis=axis2; </DIV>
<div>run; </DIV>
<div> title
height=6 pct "C7"; </DIV>
<div> vbar
C7 / name= "C7" description= "C7" </DIV>
<div>
freq type=
freq </DIV>
<div>
noframe
missing </DIV>
<div>
discrete </DIV>
<div>
raxis=axis1
maxis=axis2; </DIV>
<div>run; </DIV>
<div> title
height=6 pct "PURCHTOT"; </DIV>
<div> vbar
PURCHTOT /name= "PURCHTOT" description=
"PURCHTOT" </DIV>
<div>
freq type=
freq </DIV>
<div>
noframe
missing </DIV>
<div>
raxis=axis1
maxis=axis2; </DIV>
<div>run; </DIV>
<div>quit; </DIV>
<div>goptions display; </DIV>
<div> </DIV>
<div>* Show data set info; </DIV>
<div> </DIV>
<div>title "Contents of plotting data set"; </DIV>
<div>proc contents data= EMDATA.VIEW_4O9; </DIV>
<div>run; </DIV>
<div>title " ";</DIV>
<div><br /></DIV>
<div><br /></DIV>
<div><br /></DIV>
<div>本文用到的SAS数据集为buytest.sas7bdat,其下载地址:</DIV>
<div><!-- m --><a class="postlink" href="http://ishare.iask.sina.com.cn/f/8641118.html">http://ishare.iask.sina.com.cn/f/8641118.html</a><!-- m --></DIV>
<div>本系列全部数据下载地址:</DIV>
<div><!-- m --><a class="postlink" href="http://iask.sina.com.cn/u/1564153724/ish">http://iask.sina.com.cn/u/1564153724/ish</a><!-- m --></DIV>
<div><br /></DIV><div style="border-top: 1px solid rgb(203, 217, 217); padding-top: 20px; padding-bottom: 10px;">
<p><br><a href="http://move.blog.sina.com.cn/admin/blogmove/blogmove_msn.php" target="_blank">MSN空间完美搬家到新浪博客!</a></p></div>
欢迎光临 SAS中文论坛 (https://mysas.net/forum/)
Powered by Discuz! X3.2