全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
3700 11
2012-12-07
想问一下可不可以在一幅图中同时显示4个图呢?不是sgpanel的命令,而是用sgscatter之类的作图之后想让它们在一副图中显示,谢谢~



二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2012-12-7 21:29:31
data ex;
do x=1 to 4;
y=2*x;
output;
end;
run;

ods graphics on /reset=all;
ods html path="E:\" body="b.htm";
ods layout Start width=10in height=8in columns=2 rows=2
column_gutter=.5in row_gutter=.8in row_heights=(3.5in 3.5in);;
ods region row=1 column=1  ;
proc sgplot data=ex;
scatter x=x y=y;
run;
ods region row=1 column=2 ;
proc sgplot data=ex;
scatter x=x y=y;
run;
ods region row=2 column=1 ;
proc sgplot data=ex;
scatter x=x y=y;
run;
ods region row=2 column=2 ;
proc sgplot data=ex;
scatter x=x y=y;
run;
run;
ods layout end;
ods html close;
quit;
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2012-12-7 21:42:03
ziyenano 发表于 2012-12-7 21:29
data ex;
do x=1 to 4;
y=2*x;
谢谢~
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2012-12-8 11:41:44
另一种方法,例子:

/* Data preparation*/
data sasuser.class (drop=name );
length Gender $ 6;
set sashelp.class;
if sex="F" then Gender="Female";
else Gender="Male";
run;
proc sort data=sasuser.class out=sasuser.class;
by weight height;
run;
/* global setting*/
goptions reset=all hsize=2.75in vsize=2.06in;
ods html close;
ods listing;
axis1 label=none style=0 major=none value=none;
axis2 label=("Age");

axis3 label=("Height") order=50 to 75 by 5;
axis4 label=("Weight") order=50 to 150 by 25 minor=(n=1);
legend1 label=none value=("Male" "Female") Position=(right middle outside)
across=1;
legend2 label=none value=("Male" "Female");
symbol i=join;
/*draw chart or plot*/
proc gchart data=sasuser.class gout=sasuser.excat;
vbar age/discrete hminor=0 subgroup=gender
inside=freq raxis=axis1 maxis=axis2
noframe legend=legend1;
run;
hbar age/ discrete sumvar=height mean
meanlabel="Avg.Height" vminor=0
raxis=axis1 maxis=axis2;
run;
pie gender/ noheading legend=legend1 percent=inside;
run;
proc gplot data=sasuser.class gout=sasuser.excat;
plot height*weight=gender/ vminor=1 vaxis=axis3
haxis=axis4 legend=legend2;
run;
quit;
goptions reset=all hsize=5.5in vsize=4.12in;

/*put them together*/
proc greplay gout=sasuser.excat igout=sasuser.excat nofs
tc=sashelp.templt template=l2r2;
device win;
treplay 1:gchart 2:gchart1 3:gchart2 4:gplot;
quit;
ods listing close;
ods html;
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2012-12-8 14:15:37
webgu 发表于 2012-12-8 11:41
另一种方法,例子:

/* Data preparation*/
学习了!!谢谢^^
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2012-12-9 10:31:17
学习了。一直不善于用SAS做图,要努力了。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群