全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
4898 6
2012-05-23
1.sas能绘制k线图么?
    如果可以的话,代码怎么写?
2. 如何能够将条曲线绘制在同一张图中,比如说将五日均线与十日均线绘于一图中。
    调用哪个过程步可以实现?
谢谢!
二维码

扫码加我 拉你入群

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

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

全部回复
2012-5-24 09:20:31
SAS作图几乎没有优势
进来顶一下
二维码

扫码加我 拉你入群

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

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

2012-6-3 00:36:45
/* Set the graphics environment */
goptions reset=all cback=white border htitle=12pt htext=10pt;  

data stocks;
   input Date date7. High Low Close Open;
   datalines;
01mar99 120 110 115 113
02mar99 118 114 115 115
03mar99 120 112 113 115
04mar99 119 110 111 119
05mar99 115 113 115 115
;
run;

/* Create the Annotate data set */
data candles;
   length color function style $8;
   retain xsys ysys '2' color 'vibg' size 1;

   set stocks;

   if close > open then style='empty';
   else style ='solid';

   /* Draw the open/close box */
   function='move';     xsys='2'; ysys='2'; x=date; y=close; output;
   function='poly';     xsys='7'; ysys='2'; x=+1;   y=close; output;
   function='polycont';                             y=open;  output;
   function='polycont';                     x=-1;   y=open;  output;
   function='polycont';                             y=close; output;
   function='polycont';                     x=+.5;  y=close; output;

   /* Draw high to close and low to open */
   if close > open then do;
      function='move'; xsys='2'; ysys='2'; x=date;   y=close; output;
      function='draw'; xsys='2'; ysys='2'; x=date;   y=high;  output;

      function='move'; xsys='2'; ysys='2'; x=date;   y=open;  output;
      function='draw'; xsys='2'; ysys='2'; x=date;   y=low;   output;
   end;

   /* Draw high to open and low to close */
   if close le open then do;
      function='move'; xsys='2'; ysys='2'; x=date;   y=open;  output;
      function='draw'; xsys='2'; ysys='2'; x=date;   y=high;  output;

      function='move'; xsys='2'; ysys='2'; x=date;   y=close; output;
      function='draw'; xsys='2'; ysys='2'; x=date;   y=low;   output;
   end;
run;

symbol1 interpol=none value=none repeat=2;

axis1 minor=none offset=(5,5)pct;
axis2 label=('Price') minor=none;

title1 'Candle Stick Plots';

/* PROC GPLOT is used as a 'holding' area for the annotate. Plus, GPLOT */
/* generates the axes.  An overlay plot is used so that the vertical    */
/* axis has the complete range of the data, ie., high to low.           */
proc gplot data=stocks;
  plot high*date low*date / overlay haxis=axis1 vaxis=axis2
                            anno=candles;
  format date date5.;
run;
quit;
二维码

扫码加我 拉你入群

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

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

2012-6-3 07:43:14
这个问题我曾经也研究过,理论上sas应该可以画。
quruyi0909 代码有个问题,周六周日 或者停牌的那天,横着始终占一个位置。
二维码

扫码加我 拉你入群

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

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

2012-6-3 14:07:48
我觉得不会有这个问题呀,取决于基础数据吧?
用sas画k线其实没啥意义,呵呵。
你研究过用sas画点数图吗,如果有的话,给个代码呀,国内的行情软件中没有太好的点数图。
二维码

扫码加我 拉你入群

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

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

2012-6-19 11:19:33
quruyi0909 发表于 2012-6-3 00:36
/* Set the graphics environment */
goptions reset=all cback=white border htitle=12pt htext=10pt;  
...
十分感谢ing
二维码

扫码加我 拉你入群

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

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

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群