你好,欢迎来到经管之家 [登录] [注册]

设为首页 | 经管之家首页 | 收藏本站

基于SAS9.3的经济学人风格图(含代码)

发布时间: 来源:人大经济论坛



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

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

Name: Foreigntradecooperation.sas

Title:China's overseas contracted projects

Author::WenYiEmail: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 line-height:30px;text-indent:2em;text-align:left">run;

quit;

ods html close;

ods listing;


经管之家“学道会”小程序
  • 扫码加入“考研学习笔记群”
推荐阅读
经济学相关文章
标签云
经管之家精彩文章推荐