楼主: Rena仁桂
1626 5

[数据管理求助] 疑难!同一年份变量对应有1 也有0,留1 那行,多行1,留一行。 [推广有奖]

  • 2关注
  • 0粉丝

高中生

27%

还不是VIP/贵宾

-

威望
0
论坛币
19 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
188 点
帖子
12
精华
0
在线时间
26 小时
注册时间
2017-6-18
最后登录
2018-1-24

楼主
Rena仁桂 学生认证  发表于 2017-6-22 00:15:36 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
也是说最后的结果只要一年对应一个变量值,一年对应的变量值,如果有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,应该是
  1. keep if FRAUD==1
复制代码
已有 1 人评分论坛币 收起 理由
夏目贵志 + 10 Nice catch~

总评分: 论坛币 + 10   查看全部评分

报纸
夏目贵志 发表于 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.

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

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