楼主: china0kunpeng
4044 3

求解 merge语句多对一合并 in选项的问题,请大虾解答。多谢。 [推广有奖]

  • 0关注
  • 0粉丝

已卖:89份资源

大专生

41%

还不是VIP/贵宾

-

威望
0
论坛币
57 个
通用积分
0.1200
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
412 点
帖子
43
精华
0
在线时间
52 小时
注册时间
2005-11-3
最后登录
2020-2-8

楼主
china0kunpeng 发表于 2013-5-4 10:22:46 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
下面的例子,将a5和a6按照x变量横向合并,得到a56数据集。 a56数据集的第2、3行为什么in_b变量仍然是1?谢谢。


data a5;                                                                                                         
input x y$ @@;
cards;               
1 a 1 b 1 c 2 x 3 y               
;
run;                                                                                                                                                                                                                     
data a6;
input x y$ @@;
cards;      
1 aa 2 xx 4 yy
;           
run;                                                                                                                        
data a56;
        merge a5(in=ina) a6(in=inb);
        by x;
        in_a=ina;
        in_b=inb;
run;
二维码

扫码加我 拉你入群

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

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

关键词:Merge Input cards Data card

沙发
邓贵大 发表于 2013-5-4 11:12:44
The key exists in b too
Be still, my soul: the hour is hastening on
When we shall be forever with the Lord.
When disappointment, grief and fear are gone,
Sorrow forgot, love's purest joys restored.

藤椅
yongyitian 发表于 2013-5-4 11:23:17
each of the three x=1 in table a5   
   merged with x=1 in table a6.
   When the three merge happens, the inb does not change

     a5     a6
    x  y   x  y   _n_
    1-----1        1  
          / /   
        / /     
    1   /            2   
        /           
       /
    1               3

板凳
rdwalk 发表于 2013-5-4 13:11:12
The IN=data set option is a flag to the variable of the BY group instead of any other variables.
Because the variable x(not y) is in the BY group,so although the values(b and c) of y in table5 do not exist in table6, the flags do not change.

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

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