楼主: shinelynne
2616 14

STATA代码,求高人指点 [推广有奖]

  • 2关注
  • 4粉丝

已卖:12份资源

本科生

51%

还不是VIP/贵宾

-

威望
0
论坛币
27 个
通用积分
0
学术水平
1 点
热心指数
2 点
信用等级
1 点
经验
1456 点
帖子
62
精华
0
在线时间
112 小时
注册时间
2010-1-11
最后登录
2021-8-31

楼主
shinelynne 发表于 2012-10-15 20:07:36 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
本人做event study中,参考princeton大学给的代码整理数据,但是运行到下面的时候总是提示错误,

源代码如下:
forvalues i=1(1)r(max){/*note:replace N with the highest value of id*/
    list id Stkcd if id=='i' & dif==0
    reg Dretwd Mkttrt if id=='i' & estimation_window==1
        predict p if id=='i' /*此处i是什么???*/
        replace predicted_return=p if id=='i' & event_window==1
        drop p
        }
错误提示:
invalid syntax
r(198);



检查了好多遍,实在不知道问题出在哪里。。。/(ㄒoㄒ)/~~谢谢各位了!~

二维码

扫码加我 拉你入群

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

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

关键词:Stata 求高人指点 高人指点 tata event study

沙发
sungmoo 发表于 2012-10-15 20:41:40

藤椅
大白菜2012 发表于 2012-10-16 05:21:20
if you "set trace on", you will find out some hints of your problem.
元芳,侬怎么L00K?

板凳
bbs0805 发表于 2012-10-16 08:17:01
下面的这句有问题:
  forvalues i=1(1)r(max){/*note:replace N with the highest value of id*/
可修改为:
  local n=r(max)
   forvalue i=1/`n'  {

报纸
fgleric 发表于 2012-10-16 08:17:43
'i'---->`i'

地板
shinelynne 发表于 2012-10-16 19:55:09
fgleric 发表于 2012-10-16 08:17
'i'---->`i'
谢谢~
改过来了,可是还是说invalid syntax.......
真的无解了。。
能再帮我看看么?谢谢了~

7
shinelynne 发表于 2012-10-16 19:55:40
bbs0805 发表于 2012-10-16 08:17
下面的这句有问题:
  forvalues i=1(1)r(max){/*note:replace N with the highest value of id*/
可修改 ...
谢谢~
试过了,但是好像不是这个问题
能再帮我看看么?谢谢了~

8
shinelynne 发表于 2012-10-16 19:59:37
大白菜2012 发表于 2012-10-16 05:21
if you "set trace on", you will find out some hints of your problem.
thx a lot.  I've found where the problem is. It seems that something is wrong with " forvalues i=1(1)r(max)". But I have no idea of how to correct it .
Could you please kindly help me figure it out ?

Thank you very much!

9
shinelynne 发表于 2012-10-16 20:00:32
sungmoo 发表于 2012-10-15 20:41
https://bbs.pinggu.org/thread-92082-1-1.html
https://bbs.pinggu.org/thread-1278006-1-1.html
http://b ...
thx a lot

10
sungmoo 发表于 2012-10-16 20:39:43
r(max)若有意义,前面须有其他命令。
已有 1 人评分热心指数 收起 理由
shinelynne + 1 热心帮助其他会员

总评分: 热心指数 + 1   查看全部评分

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

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2025-12-29 21:23