全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 Stata专版
1556 5
2017-06-22
也是说最后的结果只要一年对应一个变量值,一年对应的变量值,如果有1,也有0,保留为1的那一行。一年有多行为1,只保留一行删掉多余的行。比如股票代码407 的2012年,只保留407 1 2012,这样一行就够了。其他的年份也是这个规则。 QQ截图20170622000910.png
二维码

扫码加我 拉你入群

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

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

全部回复
2017-6-22 00:19:08
duplicates drop Stkcd FRAUD year, force
keep if FRAUD==1
二维码

扫码加我 拉你入群

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

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

2017-6-22 05:16:51
夏目贵志 发表于 2017-6-22 00:19
duplicates drop Stkcd FRAUD year, force
keep if FRAUD==0
Before deleting duplicate observations, I think it is better to make sure the reason of those duplicate values, otherwise, it would lead to serious results.
二维码

扫码加我 拉你入群

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

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

2017-6-22 07:49:11
夏目贵志 发表于 2017-6-22 00:19
duplicates drop Stkcd FRAUD year, force
keep if FRAUD==0
你有 typo,应该是
复制代码
二维码

扫码加我 拉你入群

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

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

2017-6-22 09:52:07
黃河泉 发表于 2017-6-22 07:49
你有 typo,应该是
是。不好意思打错了。这就改过来。谢谢提醒。
二维码

扫码加我 拉你入群

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

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

2017-6-22 09:55:09
逍遥梦蝶 发表于 2017-6-22 05:16
Before deleting duplicate observations, I think it is better to make sure the reason of those dupl ...
You are correct. That said, in this particular case, given the amount of information available from OP, this answer is the simplest one that precisely does what OP asks for.

Of course I would hope that all posters give a complete and detailed description of their tasks, their attempts, their issues, and all relevant codes and data. But God (and all the old posts on this forum) be my witness - it rarely happens. So nowadays I sometimes don't bother anymore and just answer the question directly.
二维码

扫码加我 拉你入群

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

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

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

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