全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
11591 10
2013-01-17
有两个数据集A和B,如下:
数据集A数据集B
dategroup nodategroup no
2012-1-3a22012-1-8a4
2012-1-11a42012-1-13a8
2012-1-12a52012-1-18a4
2012-1-6b32012-2-5b3
2012-1-21b72012-3-8c2
2012-2-8c112012-3-17c10
2012-3-9c452012-1-17d4
2012-5-10c2
2012-1-11d113


想得到的结果是针对B中每一条数据都要找到A中的一条数据相对应,并将B的"date"、"NO"连接到A数据集中,规则:A中满足”date"<=B中"date" 且 A 中“group"=B中“group"条件的所有数据中“NO”最大的数据,从B的第一条开始匹配,一旦匹配成功那么A中该条数据就不参与下一次匹配过程,有点类似不放回抽样。请各位大牛予以帮助,拜谢。



二维码

扫码加我 拉你入群

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

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

全部回复
2013-1-17 01:36:21
match by which column?
二维码

扫码加我 拉你入群

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

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

2013-1-17 02:51:39
assume only group is character and no missing. jingju
我想问题有些说反了.我理解是把A里的匹配到B里.


复制代码


二维码

扫码加我 拉你入群

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

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

2013-1-17 09:04:27
.....
二维码

扫码加我 拉你入群

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

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

2013-1-17 15:39:25
如果GROUP 下面还有SUBGROUP(也是字符型,比如a1-a3)应当如何处理呢?如果GROUP包含缺失值会导致什么错误呢?请指教,谢谢!

二维码

扫码加我 拉你入群

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

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

2013-1-17 23:26:16
nuomaniya 发表于 2013-1-17 15:39
如果GROUP 下面还有SUBGROUP(也是字符型,比如a1-a3)应当如何处理呢?如果GROUP包含缺失值会导致什么错误呢 ...
add one more condition for the subgroup as we did for group.
Missing group values in set B are misleading here because we don't know which groups in A should be matched. I would delete the missing group from B before matching or conditionally excute the code for missing goup. For example,
复制代码

The consequence of including missing groups in our code is, since we are sampling without replacement, we reset the matched group in A as missing after one match in order to prevent from next match and thus the reset missing could be mixed with the original missing.
Jingju
二维码

扫码加我 拉你入群

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

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

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

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