- 阅读权限
- 255
- 威望
- 0 级
- 论坛币
- 4511 个
- 通用积分
- 76.8946
- 学术水平
- 171 点
- 热心指数
- 204 点
- 信用等级
- 133 点
- 经验
- 24578 点
- 帖子
- 583
- 精华
- 1
- 在线时间
- 1865 小时
- 注册时间
- 2008-5-25
- 最后登录
- 2025-4-28
|
- %macro comment(); /*这是一种比较特殊的注释方式*/
- Picture: Box Plot – Vertical – Interval with Groups (using template and sgrender procedure)
- Software: SAS 9.4 TS Level 1M2
- Name: justsoso
- Date: 20180229
- From: Getting Started with the Graph Template Language in SAS:
- Examples, Tips, and Techniques for Creating Custom Graphs
- History: 20180229;
- %mend;
- /*建立数据集GTL_GS_IntervalBoxGroup,用于后续画图*/
- data GTL_GS_IntervalBoxGroup;
- format Date date6.;
- drop i;
- do Date='01Jan2009'd, '15Jan2009'd,'15Mar2009'd,
- '01May2009'd, '01Aug2009'd;
- do i=1 to 10;
- Response=rannorm(2); Drug='A'; output;
- Response=ranuni(2); Drug='A'; output;
- Response=rannorm(2); Drug='B'; output;
- Response=ranuni(2); Drug='B'; output;
- end;
- end;
- run;
- ods _all_ close; /*关闭所有ods destinations,避免不必要的输出,节省计算机资源*/
- /*ods listing gpath='C:\Users\Administrator\Desktop\test20180229' image_dpi=100;*/
- ods listing gpath='C:\Users\Administrator\Desktop\test20180229';
- /*打开ods listing这一destination,指定图片保存路径,★★★★★需提前建立*/
- /*ods graphics on / imagename="picture" outputfmt=pdf width=4in height=2.5in;*/
- /*ods graphics on / imagename="picture" outputfmt=pdf;*/
- /*图片名称picture,输出类型pdf*/
- ods graphics off;
- /*Box Plot – Vertical – Interval with Groups*/
- proc template; /*--SAS 9.4--*/
- define statgraph Fig_4_4_4;
- begingraph / attrpriority=color;
- entrytitle 'Response by Time and Treatment';
- layout overlay / yaxisopts=(griddisplay=on)
- xaxisopts=(type=time timeopts=(interval=month)
- display=(ticks tickvalues));
- boxplot x=date y=response / group=drug groupdisplay=cluster
- name='a';
- discretelegend 'a' / title='Treatment:' location=inside
- halign=right valign=bottom;
- endlayout;
- endgraph;
- end;
- run;
- proc sgrender data=GTL_GS_IntervalBoxGroup template=Fig_4_4_4;
- run;
- ods _all_ close;
- /*ods html; 最好将ods destination恢复至默认的html*/
复制代码
|
|