楼主: benoit_louis
4949 6

sas能绘制k线图么? [推广有奖]

  • 3关注
  • 2粉丝

已卖:32份资源

博士生

21%

还不是VIP/贵宾

-

威望
0
论坛币
2 个
通用积分
173.7345
学术水平
6 点
热心指数
6 点
信用等级
6 点
经验
802 点
帖子
121
精华
0
在线时间
324 小时
注册时间
2011-2-1
最后登录
2025-7-25

楼主
benoit_louis 发表于 2012-5-23 21:34:40 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
1.sas能绘制k线图么?
    如果可以的话,代码怎么写?
2. 如何能够将条曲线绘制在同一张图中,比如说将五日均线与十日均线绘于一图中。
    调用哪个过程步可以实现?
谢谢!
二维码

扫码加我 拉你入群

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

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

关键词:K线图 张图中

沙发
air320322 发表于 2012-5-24 09:20:31
SAS作图几乎没有优势
进来顶一下
不明真相的群众

藤椅
quruyi0909 发表于 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;

板凳
luijb 在职认证  发表于 2012-6-3 07:43:14
这个问题我曾经也研究过,理论上sas应该可以画。
quruyi0909 代码有个问题,周六周日 或者停牌的那天,横着始终占一个位置。
西格玛临床统计服务工作室http://www.sigma-stat.com/,luijb@163.com

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

地板
benoit_louis 发表于 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

7
龙潭丰乐 学生认证  发表于 2012-11-7 18:14:50
quruyi0909 发表于 2012-6-3 00:36
/* Set the graphics environment */
goptions reset=all cback=white border htitle=12pt htext=10pt;  
...
请问一下function那块是什么意思?

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

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-1-1 17:42