楼主: yukiooy
11203 16

(SAS作点线图加上标准差)怎样在SAS中做点线图并加上标准差 [推广有奖]

  • 3关注
  • 5粉丝

院士

0%

还不是VIP/贵宾

-

威望
0
论坛币
14152 个
通用积分
73.5400
学术水平
17 点
热心指数
27 点
信用等级
9 点
经验
760 点
帖子
1394
精华
0
在线时间
1235 小时
注册时间
2008-12-22
最后登录
2023-8-11

相似文件 换一批

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
图例.jpg 如上图所示,
A组数据是一列观察值,用方块表示;

B组数据是每一行是3次重复的平均值,用三角表示,该组数据同时给出了标准差。
问题是:怎样在SAS中做如上图所示的点线图并给B组数据加上标准差?

数据用例如下:

ABB的标准差

33.99

33.95

1.5

29.54

29.73

2.5

25.80

25.91

3.6

29.45

29.50

5

21.92

22.11

4

25.10

25.38

0.99

23.53

23.61

1

26.92

27.35

2

25.53

25.81

4

28.04

28.09

7



二维码

扫码加我 拉你入群

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

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

关键词:标准差 ABB 平均值 标准差 平均值

回帖推荐

ziyenano 发表于6楼  查看完整内容

用gplot试试: DATA ex; x=_n_; INPUT A B B_STD; y=b-b_std; output; y=b+b_std; output; DATALINES; 33.99 33.95 1.5 29.54 29.73 2.5 25.80 25.91 3.6 29.45 29.50 5 21.92 22.11 4 25.10 25.38 0.99 23.53 23.61 1 26.92 27.35 2 25.53 25.81 4 28.04 28.09 7 ; RUN; symbol1 i=join v=square c=blue; symbol2 i=join v=triangle c=red; symbol3 i=hiloctj c=green; proc gplot data=ex; plot a*x= ...

jingju11 发表于7楼  查看完整内容

Please don't make SAS even more complicated! Jingju

xiaodanzi 发表于2楼  查看完整内容

Damn *****! No mind on work!

本帖被以下文库推荐

沙发
xiaodanzi 发表于 2013-1-29 14:49:26 |只看作者 |坛友微信交流群
  1. PROC DATASETS LIBRARY=WORK KILL NOLIST;QUIT;

  2. DATA DATAIN;
  3. X=_N_;
  4.         INPUT A B BSTD;
  5. DATALINES;
  6. 33.99 33.95 1.5
  7. 29.54 29.73 2.5
  8. 25.80 25.91 3.6
  9. 29.45 29.50 5
  10. 21.92 22.11 4
  11. 25.10 25.38 0.99
  12. 23.53 23.61 1
  13. 26.92 27.35 2
  14. 25.53 25.81 4
  15. 28.04 28.09 7
  16. ;
  17. RUN;

  18. DATA DATAUSE;
  19.         SET DATAIN(RENAME=(A=VALUE) DROP=B BSTD);
  20.         STD=0;GROUP="A";OUTPUT;
  21.         SET DATAIN(RENAME=(B=VALUE BSTD=STD) DROP=A);
  22.         GROUP="B";OUTPUT;
  23. RUN;
  24. DATA DATAUSE;
  25.         SET DATAUSE;
  26.         YLOW=VALUE-STD;
  27.         YUP=VALUE+STD;
  28. RUN;



  29. *Template Codes;
  30. proc template;
  31. define statgraph barChart;
  32. begingraph/backgroundcolor=white border=False;
  33.         EntryTitle "LineChart with ErrorBars showing (*ESC*){unicode '00B1' x} SE"/textattrs=(size=10pt) pad=(bottom=10);
  34.         layout LATTICE /columns=1;
  35.                    layout OVERLAY/
  36.                 Xaxisopts=(gridDisplay=ON LABEL="Observation" LABELATTRS=(weight=bold color=black)
  37.                                         LINEAROPTS=(TICKVALUEFITPOLICY=rotate TICKVALUEPRIORITY=TRUE))
  38.                 Yaxisopts=(gridDisplay=ON LABEL="Mean" LABELATTRS=(weight=bold color=black));
  39.                            ReferenceLine y=30;
  40.                         *ErrorBar;
  41.                         Scatterplot X=X  Y=VALUE/ primary=true index=trtnum yerrorlower=ylow yerrorupper=yup
  42.                 name="scatter"  
  43.                                 GROUP=group /***Group A&B here in a new colume**/
  44.                          errorbarattrs=(thickness=2) markerattrs=(size=8 weight=bold);
  45.                         *Series;
  46.                            SERIESPLOT         X=X  Y=VALUE/primary=true name="Series1" group=group;
  47.                   endlayout;
  48.         *DiscreteLegend;
  49.         sidebar / align=bottom spacefill=false;
  50.                        discretelegend "Series1" / across=2 valueattrs=(size=10pt) pad=10px border=False;
  51.            endsidebar;
  52.         endlayout;
  53. Endgraph; end; run;

  54. *Call template;
  55. proc sgrender data=DATAUSE template=barChart; run;
复制代码
Damn *****! No mind on work!

SGRender5.png (23.39 KB)

SGRender5.png

已有 1 人评分经验 论坛币 学术水平 热心指数 信用等级 收起 理由
webgu + 60 + 60 + 1 + 1 + 1 精彩帖子

总评分: 经验 + 60  论坛币 + 60  学术水平 + 1  热心指数 + 1  信用等级 + 1   查看全部评分

使用道具

藤椅
yukiooy 发表于 2013-1-29 15:12:42 |只看作者 |坛友微信交流群
Hi, xiaodanzi,多谢你,太厉害了!

使用道具

板凳
xiaodanzi 发表于 2013-1-29 15:30:35 |只看作者 |坛友微信交流群
yukiooy 发表于 2013-1-29 15:12
Hi, xiaodanzi,多谢你,太厉害了!
{:2_25:}

使用道具

报纸
henryyhl 发表于 2013-1-29 17:48:48 |只看作者 |坛友微信交流群
真是厉害啊
It's not going to be easy, but it is going to be worth it.

使用道具

地板
ziyenano 发表于 2013-1-29 17:57:09 |只看作者 |坛友微信交流群
用gplot试试:
DATA ex;
x=_n_;
INPUT A B B_STD;
y=b-b_std;
output;
y=b+b_std;
output;
DATALINES;
33.99 33.95 1.5
29.54 29.73 2.5
25.80 25.91 3.6
29.45 29.50 5
21.92 22.11 4
25.10 25.38 0.99
23.53 23.61 1
26.92 27.35 2
25.53 25.81 4
28.04 28.09 7
;
RUN;

symbol1 i=join v=square c=blue;
symbol2 i=join v=triangle c=red;
symbol3 i=hiloctj c=green;
proc gplot data=ex;
plot a*x=1 b*x=2 y*x=3/overlay;
run;
quit;
已有 1 人评分学术水平 热心指数 信用等级 收起 理由
webgu + 1 + 1 + 1 精彩帖子

总评分: 学术水平 + 1  热心指数 + 1  信用等级 + 1   查看全部评分

使用道具

7
jingju11 发表于 2013-1-29 23:12:34 |只看作者 |坛友微信交流群
Please don't make SAS even more complicated! Jingju

_4.PNG
  1. DATA ex;
  2. INPUT A B B_STD;
  3. t ++1;
  4. b_l =b-b_std;
  5. B_u =b+b_std;
  6. DATALINES;
  7. 33.99 33.95 1.5
  8. ...
  9. ;
  10. proc sgplot noautolegend;
  11. scatter x =t y =b/yErrorLower =b_l yErrorUpper =b_u markerattrs =(size =0);
  12. series x =t y =b/markers markerattrs =(symbol =squarefilled) name ="sb";
  13. series x =t y =a/ lineAttrs =(color =blue) markers markerattrs =(symbol =TriangleFilled) name ="sa";
  14. keyLegend "sa" "sb"/location =inside;
  15. xaxis values =(1 to 10 by 1) ;
  16. yaxis grid display =(noLabel);
  17. run;
复制代码


已有 1 人评分学术水平 热心指数 信用等级 收起 理由
webgu + 1 + 1 + 1 精彩帖子

总评分: 学术水平 + 1  热心指数 + 1  信用等级 + 1   查看全部评分

使用道具

8
hu0204 发表于 2013-2-21 09:59:11 |只看作者 |坛友微信交流群
看看··借用··

使用道具

9
zhangbiaoeins 发表于 2013-4-7 22:37:25 |只看作者 |坛友微信交流群
有道理!

使用道具

10
zhitler 发表于 2014-2-1 12:52:20 |只看作者 |坛友微信交流群
非常棒的答案

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-4-26 18:26