楼主: BraveMadMan
5953 35

[程序分享] 如何生成这个图 [推广有奖]

21
BraveMadMan 发表于 2010-7-13 22:29:21
20# jingju11

多谢jinggu11。看你的图,那个-5000在图上是不显示的,不过为什么我的就不行呢?

fig6.PNG

并且proc format的log显示有错误:
214  title;
215  proc format;
216  value Yfmt -5000 = ' ' 0-5000 = [best.];
NOTE: The BEST (in)format was specified on the right-hand side of an equal sign, but without a
      length specification. PROC FORMAT will assume a default length of at least 40 for the
      format being generated. If this is an insufficient width, you can rerun PROC FORMAT with an
      explicit width for the BEST (in)format, or provide a sufficient DEFAULT= option.
NOTE: Format YFMT is already on the library.
NOTE: Format YFMT has been output.
217  value pfmt -15 - 15 = [best.] 35 = ' ';
NOTE: The BEST (in)format was specified on the right-hand side of an equal sign, but without a
      length specification. PROC FORMAT will assume a default length of at least 40 for the
      format being generated. If this is an insufficient width, you can rerun PROC FORMAT with an
      explicit width for the BEST (in)format, or provide a sufficient DEFAULT= option.
NOTE: Format PFMT is already on the library.
NOTE: Format PFMT has been output.
218  run;

NOTE: PROCEDURE FORMAT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


  1. title;
  2. proc format;
  3. value Yfmt -5000 = ' ' 0-5000 = [best.];
  4. value pfmt -15 - 15 = [best.] 35 = ' ';
  5. run;
  6. proc sgplot data=stat_qtr1 NOAUTOLEGEND;
  7. needle x =yqtr y =p_pos/baseline =0 lineattrs =(color =blue thickness =3);
  8. needle x =yqtr y =p_neg/baseline =0 lineattrs =(color =red thickness =3);
  9. series x =yqtr y =all/y2axis lineattrs =(color =green thickness =2);;
  10.   format yqtr year2. all Yfmt.;
  11.   format p_pos 6.2 all pfmt.;
  12.   format p_neg 6.2 all pfmt.;
  13. xaxis label = "Year";
  14. yaxis grid values =(-15 to 15 by 10 35) label="Percentage" ;
  15. y2axis grid values =(-5000 0 to 5000 by 1000) label="# of observations" ;
  16. run; quit;
复制代码

22
jingju11 发表于 2010-7-13 23:04:55
21# BraveMadMan

first, it should be (or the best) like that  [best7.] ..
另外,why 35 not gone?原因是用的是format 6.2 而不是你定义的。

23
BraveMadMan 发表于 2010-7-13 23:21:47
22# jingju11
all done!

fig6.PNG

  1. title;
  2. proc format;
  3. value yfmt -5000 = ' ' 0-5000 = [best7.] ;
  4. value pfmt -15 - 15 = [best7.] 35 = ' ';
  5. run;
  6. proc sgplot data=stat_qtr1 NOAUTOLEGEND;
  7. needle x =yqtr y =p_pos/baseline =0 lineattrs =(color =blue thickness =3);
  8. needle x =yqtr y =p_neg/baseline =0 lineattrs =(color =red thickness =3);
  9. series x =yqtr y =all/y2axis lineattrs =(color =green thickness =2);;
  10.   format yqtr year2. all yfmt. p_pos pfmt. p_neg pfmt.;
  11. xaxis label = "Year";
  12. yaxis grid values =(-15 to 15 by 10 35) label="Percentage" ;
  13. y2axis grid values =(-5000 0 to 5000 by 1000) label="# of observations" ;
  14. run; quit;
复制代码

24
满分卷纸 发表于 2010-7-13 23:41:08
不是不能带价放配置吗?馒头短路了?再看看lz的内存。2g的才145。那里copy的配置啊?几年前的高端配置?

25
tracyyang 发表于 2010-7-14 08:26:22
蛮复杂的,学习了。

26
baojiwolong 发表于 2010-7-14 10:40:20
SAS作图还可如此,学习了!

楼主是否可以把数据再放上来,以飨众人!

27
BraveMadMan 发表于 2010-7-14 10:54:48
baojiwolong 发表于 2010-7-14 10:40
SAS作图还可如此,学习了!

楼主是否可以把数据再放上来,以飨众人!
数据重新发了。

28
sxlion 发表于 2010-7-14 10:59:11
真讨厌,刚刚用随机数模拟了一把。

pinggu.PNG (22.02 KB)

pinggu.PNG

29
sxlion 发表于 2010-7-14 11:48:22
proc format;
picture posval low-high='000,009';
run;
proc sgplot data=stat_qtr1 NOAUTOLEGEND;
/*proc sgplot data=sss.bravemadman NOAUTOLEGEND;*/
needle x =yqtr y =p_pos/baseline =0 lineattrs =(color =blue thickness =3);
needle x =yqtr y =p_neg/baseline =0 lineattrs =(color =red thickness =3);
series x =yqtr y =all/y2axis lineattrs =(color =green thickness =2);;
  format yqtr year2. all p_neg p_pos posval. ;
xaxis label = "Year"; yaxis label="Percentage" ;
yaxis grid values =(-10 to 10 by 5 20) label="# of observations" ;
y2axis  values =(-5000 to 5000 by 1000) label="# of observations" ;
run; quit;

顺便问一下,你的数据格式问题,为什么我的logo报这个:
1397  proc sgplot data=sss.bravemadman NOAUTOLEGEND;

xxx.JPG

ps:楼主,我在博客里面用了这个数据,希望楼主能够同意,否则我就要我那丑陋的随机模拟数据了,谢谢。

30
BraveMadMan 发表于 2010-7-14 12:00:34
29# sxlion

我也不知道为什么会出现这样的错误信息。

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

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-25 17:45