全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
1710 3
2013-09-12

SAS作图



说明:这是闲着没事做的经济学人风格系列图之一,分享一个给大家,如有转载请注明出处,以下源代码只能SAS9.3及以上才能使用!

/*---------------------------------------------------------*\

Name: Foreigntradecooperation.sas

Title:China's overseas contracted projects

Author::WenYi  Email:dear&mmu.me

From:http://www.douban.com/group/sasfinance/

Created:2012/06/26 SAS9.3

\*---------------------------------------------------------*/

ods listing close;

ods html file='mbar.html' path='.' ;

ods graphics/reset width=600px height=480px imagename='Foreigntradecooperation' imagefmt=png;

title j=left color=black height=2 font=arialblack " China's overseas contracted projects";

title2 j=left color=black font=arial 'The value of newly-signed contracts';

footnote justify=left color=cx7e96c2 'Source:Ministry Of Commerce,PRC' justify=right color=cx7e96c2 'Graph by WenYi' ;

data squares;

infile datalines dlm='#';

length fillcolor $ 9

display $ 9

function $ 12

linecolor $ 9;

input function $ x1 y1 width height fillcolor linecolor display;

datalines;

rectangle # 0 # 113 # 5#10 # cxd5272b # cxd5272b #all

;

run;

data work.contract;

input t yymmn6. dd tb;

cards;

201008        143.8        128.2539683

201009        70.6        29.06764168

201010        141.4        13.30128205

201011        141.8        122.9559748

201012        241        22.39715592

201101        103.9        -25.78571429

201102        73.7        56.80851064

201103        131.9        68.67007673

201104        127.1        25.59288538

201105        123.2        39.84108967

201106        102.1        7.586933614

201107        95.8        71.07142857

201108        84        -41.58553547

201109        89.5        26.77053824

201110        114.5        -19.02404526

201111        95.5        -32.651622

201112        282.1        17.05394191

201201        93.3        -10.20211742

201202        51.5        -30.12211669

201203        152.8        15.84533738

201204        55.8        -56.09756098

201205        85.2        -30.84415584

;

run;

proc sgplot data=work.contract sganno=squares;

vbar t/response=dd barwidth=0.3 fill fillattrs=(color=cx349cdf) legendlabel='Contracts,billions of dollars';

vline t /response=tb markers y2axis limits=both lineattrs=(color=cx86351c thickness=3) markerattrs=(color=cx86351c size=3) legendlabel='%change year on year';

format t mmyy5.;

xaxis display=(nolabel);

yaxis values=(0 to 300 by 50) display=(nolabel) valueattrs=(color=cx349cdf weight=bold);

y2axis values=(-100 to 200 by 50) display=(nolabel) grid minor valueattrs=(color=cx86351c weight=bold);

keylegend / noborder down=1 location=outside position=topleft valueattrs=(color=black size=11 style=italic weight=normal);

run;

quit;

ods html close;

ods listing;














二维码

扫码加我 拉你入群

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

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

全部回复
2014-3-20 11:18:58
学习
二维码

扫码加我 拉你入群

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

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

2014-3-21 13:59:38
很厉害的样子
二维码

扫码加我 拉你入群

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

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

2014-3-24 10:09:24
谢谢分享~~~~~~~~~~~~~
二维码

扫码加我 拉你入群

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

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

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

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