As an Economist reader, I really appreciate their graphics. As a SAS user, I want to recreate Economist’s graph and use it in my work. So I envisage making some Economist’s Graphs’ Template, and this one is the second one. You can find the other plots here : http://blog.data2biz.org/?cat=4
Any suggestions, critics, helps will be appreciated.
The original graph is in :[url]http://www.economist.com/blogs/graphicdetail/2014/05/daily-chart-18[/url]
/* ====== Reproduce Graph Using SAS ============== *\
Note : The data we use is fictitious.
/*---------------------------------------------------------*\
Name: Eband.sas
Title:Number employed in the developing word by income group
Author:WenYi&WW
Blog: http://blog.data2biz.org/
Source:http://www.economist.com/blogs/g ... 4/05/daily-chart-18
Created:2014/06/03 SAS9.3
\*---------------------------------------------------------*/
/*读取数据文件*/
data fivestocks;
input date $ 1-10 a1 b2 c3 d4 f5;
cards;
2006/12/31 0.75 1.35 1.61 1.9 1.95
2007/12/31 0.72 1.3 1.65 1.92 1.99
2008/12/31 0.73 1.31 1.68 1.93 2.12
2009/12/31 0.7 1.35 1.72 2 2.23
2010/12/31 0.65 1.31 1.66 2.11 2.35
2011/12/31 0.6 1.28 1.64 2.21 2.43
2012/12/31 0.56 1.12 1.6 2.23 2.56
2013/12/31 0.46 0.94 1.56 2.3 2.68
2014/12/31 0.4 0.87 1.52 2.36 2.81
2015/12/31 0.32 0.73 1.45 2.48 2.95
;
run;
/*设置模板*/
proc template;
define statgraph fivestocks; /*定义主题名称*/
begingraph/border=false; /*无边框*/
entrytitle halign=left "Number employed in the developing word by income group" / TEXTATTRS=(COLOR=black FAMILY='微软雅黑' size=18 STYLE=normal WEIGHT=bold) ; /*设置标题*/
entrytitle halign=left "Bn(2005$ at PPP*,per day)" / TEXTATTRS=(color=black family='微软雅黑' size=12 style=italic weight=normal) ;/*设置副标题*/
layout overlay/WALLDISPLAY=none xaxisopts=( display=(line ticks tickvalues) type=discrete tickvalueattrs = (FAMILY='Arial' COLOR=black)) yaxisopts=(griddisplay=on GRIDATTRS=(THICKNESS=2.5) display=NONE DISPLAYSECONDARY=(TICKVALUES) TICKVALUEATTRS=(COLOR=black FAMILY='微软雅黑' size=10 STYLE=normal WEIGHT=normal)) ;
bandplot x=date limitupper=f5 limitlower=0/FILLATTRS = (COLOR=cx00a1ce) DISPLAY=all OUTLINEATTRS=(color=cx191612 PATTERN=1 THICKNESS=3) DATATRANSPARENCY=0; /*画图*/
bandplot x=date limitupper=d4 limitlower=0/FILLATTRS = (COLOR=cx00485d) DISPLAY=all OUTLINEATTRS=(color=cxf8fbfc PATTERN=1 THICKNESS=3) DATATRANSPARENCY=0;
bandplot x=date limitupper=c3 limitlower=0/FILLATTRS = (COLOR=cx5a8098) DISPLAY=all OUTLINEATTRS=(color=cxf8fbfc PATTERN=1 THICKNESS=3) DATATRANSPARENCY=0;
bandplot x=date limitupper=b2 limitlower=0/FILLATTRS = (COLOR=cxeea083) DISPLAY=all OUTLINEATTRS=(color=cxf8fbfc PATTERN=1 THICKNESS=3) DATATRANSPARENCY=0;
bandplot x=date limitupper=a1 limitlower=0/FILLATTRS = (COLOR=cxe9744f) DISPLAY=all OUTLINEATTRS=(color=cxf8fbfc PATTERN=1 THICKNESS=3) DATATRANSPARENCY=0;
drawrectangle x=81 y=5 width=100 height=400 /anchor=bottomleft display=(fill) fillattrs=(color=gray) transparency=0.75 widthunit=pixel heightunit=pixel ; /*画半透明矩形*/
drawrectangle x=-6 y=105 width=39 height=55/anchor=bottomleft display=(fill) fillattrs=(color=cxe11b17) widthunit=pixel heightunit=pixel ;
/*画红色矩形标志*/
entry halign=right "Forecast" / valign=bottom PAD=(bottom=375px right=20px ) TEXTATTRS=(COLOR=black FAMILY='Arial' size=16 STYLE=italic WEIGHT=normal);/*文字*/
entry halign=right "Extremely poor" /valign=bottom pad=(bottom=40px right=270) TEXTATTRS=(COLOR=cxffffff FAMILY='微软雅黑' size=12 STYLE=normal WEIGHT=bold);
entry halign=right "(less than $1.25)" /valign=bottom pad=(bottom=25px right=270) TEXTATTRS=(COLOR=cxffffff FAMILY='微软雅黑' size=12 STYLE=italic WEIGHT=bold);
entry halign=right "Moderately poor" /valign=bottom pad=(bottom=120px right=270) TEXTATTRS=(COLOR=cxffffff FAMILY='微软雅黑' size=12 STYLE=normal WEIGHT=bold);
entry halign=right "($1.25-$2)" /valign=bottom pad=(bottom=105px right=270) TEXTATTRS=(COLOR=cxffffff FAMILY='微软雅黑' size=12 STYLE=italic WEIGHT=bold);
entry halign=right "Near poor" /valign=bottom pad=(bottom=185px right=270) TEXTATTRS=(COLOR=cxffffff FAMILY='微软雅黑' size=12 STYLE=normal WEIGHT=bold);
entry halign=right "($2-$4)" /valign=bottom pad=(bottom=170px right=270) TEXTATTRS=(COLOR=cxffffff FAMILY='微软雅黑' size=12 STYLE=italic WEIGHT=bold);
entry halign=right "Developing middle class" /valign=bottom pad=(bottom=230px right=270) TEXTATTRS=(COLOR=cxffffff FAMILY='微软雅黑' size=12 STYLE=normal WEIGHT=bold);
entry halign=right "($4-$13)" /valign=bottom pad=(bottom=215px right=270) TEXTATTRS=(COLOR=cxffffff FAMILY='微软雅黑' size=12 STYLE=italic WEIGHT=bold);
entry halign=right "Developed middle class and above " /valign=bottom pad=(bottom=345px right=270) TEXTATTRS=(COLOR=black FAMILY='微软雅黑' size=12 STYLE=normal WEIGHT=bold);
entry halign=right "(above $13)" /valign=bottom pad=(bottom=330px right=270) TEXTATTRS=(COLOR=black FAMILY='微软雅黑' size=12 STYLE=italic WEIGHT=bold);
drawline x1=56 y1=92 x2=60 y2=92 /x1space=wallpercent y1space=wallpercent x2space=wallpercent y2space=wallpercent lineattrs=(color=black THICKNESS=1) layer=front transparency=0.8; /*画线*/
drawline x1=60 y1=92 x2=60 y2=78 /x1space=wallpercent y1space=wallpercent x2space=wallpercent y2space=wallpercent lineattrs=(color=black THICKNESS=1) layer=front transparency=0.8;
drawoval x=59.4 y=77.5 width=0.5 height=0.85 /ANCHOR=center display=all fillattrs=(color=black) outlineattrs=(color=black) transparency=0.25;/*画点*/
endlayout;
entryfootnote halign=left TEXTATTRS=( family='Verdana' size=8 style=normal) "blog.data2biz.org" halign=right TEXTATTRS=( family='Arial' size=8 style=italic) "Graph by WenYi&WW" ; /*设置脚注*/
endgraph;
end;
run;
ods graphics / width=1190px height=860px border=off;/*设置图形*/
ods listing;
proc sgrender data=fivestocks template=fivestocks;/*引用数据和模板画图*/
run;