楼主: guqing1222
5955 10

[原创博文] 高人帮忙解决个小问题!严重感谢! [推广有奖]

  • 0关注
  • 0粉丝

高中生

72%

还不是VIP/贵宾

-

威望
0
论坛币
36 个
通用积分
0
学术水平
4 点
热心指数
4 点
信用等级
4 点
经验
689 点
帖子
28
精华
0
在线时间
34 小时
注册时间
2009-3-24
最后登录
2015-1-28

楼主
guqing1222 发表于 2010-7-31 03:38:30 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
我是试用从WRDS 上下载的SAS code做的动量策略,例子里的数据是从CRSP 上下载的美国股市1965-1989的数据(sas格式),用这个的时候,这组code运行的很好,结果也和例子一样,可是当我换了一组变量名称一样的excel格式的数据时,系统出现了好多错误,这是怎么回事啊?我在换数据的时候,名称都对应和例子里的一样!而且我sas9.1和8.2两个版本都试了,都是一样的结果!请教高手这是为什么?下面是错误的地方:
178  proc sql;
179      create table umd
180      as select distinct a.permno, a.date, exp(sum(log(1+b.ret))) - 1 as cum_return
181      from msex2 (keep=permno date) as a, msex2 as b
182      where a.permno=b.permno and 0<=intck('month', b.date, a.date)<&J
183    group by a.permno, a.date
184    having count(b.ret)=&J;
ERROR: Expression using addition (+) requires numeric types.
ERROR: Function INTCK requires a numeric expression as argument 2.
ERROR: Function INTCK requires a numeric expression as argument 3.
ERROR: Expression using less than or equal (<=) has components that are of different data types.
ERROR: Function INTCK requires a numeric expression as argument 2.
ERROR: Function INTCK requires a numeric expression as argument 3.
ERROR: Expression using less than  (<) has components that are of different data types.
185  quit;
二维码

扫码加我 拉你入群

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

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

关键词:小问题 proc sql Distinct Excel格式 Select

已有 1 人评分学术水平 热心指数 信用等级 收起 理由
rdzhang + 1 + 1 + 1 鼓励积极发帖讨论

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

沙发
mydo 发表于 2010-7-31 04:02:16
can you run proc contents for data msex2
to check types of related variables first?

藤椅
guqing1222 发表于 2010-7-31 04:19:24
2# mydo Thank u very much. After run the contents, I found that all the variable types are characteristic, not numeric. But how can I change the data type? Acturally, there are all date and return, that is numerical, right?
本文来自: 人大经济论坛 SAS专版 版,详细出处参考:http://www.pinggu.org/bbs/viewthread.php?tid=872423&page=1&from^^uid=936067
已有 1 人评分学术水平 热心指数 信用等级 收起 理由
rdzhang + 1 + 1 + 1 楼主的英文很溜呀

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

板凳
jingju11 发表于 2010-7-31 04:39:52
3# guqing1222
你用的是什么破excel?居然让sas吧日期当成text来读。如果现象奇怪,就说明可能有问题。所以往往不是转换类型就能解决的。

报纸
guqing1222 发表于 2010-7-31 05:28:33
4# jingju11 哦,这样子,,,我也觉得有问题,只是看不出来问题在哪里。 我换成了numeric以后,错误跟着变成了:178  proc sql;
179      create table umd
180      as select distinct a.PERMNO, a.DATE, exp(sum(log(1+b.RET))) - 1 as cum_return
181      from msex2 (keep=permno date) as a, msex2 as b
182      where a.permno=b.permno and 0<=intck('month', b.date, a.date)<&J
183    group by a.permno, a.date
184    having count(b.ret)=&J;
NOTE: Invalid argument 1 to function INTCK. Missing values may be generated.
NOTE: Invalid arguments to the LOG function have caused the function to return a missing value.
NOTE: Table WORK.UMD created, with 0 rows and 3 columns.
185  quit;
NOTE: PROCEDURE SQL used:
      real time           0.13 seconds
      cpu time            0.13 seconds
不知道这个公式哪里错了,因为刚才用sample数据的时候还好好的。。

地板
BraveMadMan 发表于 2010-7-31 06:21:54
试试用STAT/TRANSFER先把数据从excel格式转换成SAS格式
Don't get lost in technical details. What is the big picture?

7
guqing1222 发表于 2010-7-31 18:59:23
哇塞!我下了S ATA TRANSFER以后,整个问题都解决啦!不知道为什么sas转换excel就不能用,这个软件真是个好东东。。谢谢! 6# BraveMadMan

8
suly 发表于 2010-8-1 13:16:48
0<=intck('month', b.date, a.date)<&J
183    group by a.permno, a.date
184    having count(b.ret)=&J;
这个命令是什么意思啊。你是如何在那里下载code的,我没看到下载的页面。我现在也在做策略

9
BraveMadMan 发表于 2010-8-1 21:29:59
suly 发表于 2010-8-1 13:16
0
楼主说过了,“从WRDS 上下载的SAS code做的动量策略”。
Don't get lost in technical details. What is the big picture?

10
tracyyang 发表于 2010-8-2 05:49:36
8# suly

就是a日期和b日期之间相差的月份值大于等于0而小于变量J。

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

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