楼主: akalius
2607 13

请教一个多多合并问题 [推广有奖]

11
sonypam 在职认证  发表于 2017-3-26 11:33:23
Hi akalius,
    This website will automatically reformat the input statement in data main step (input comayearqtrcomb varm;), so please see the full code in attachment.

12
akalius 学生认证  发表于 2017-3-26 16:21:39
sonypam 发表于 2017-3-26 11:33
Hi akalius,
    This website will automatically reformat the input statement in data main step (in ...
为什么一定要用index1 and index2 呢    在排序中感觉没有体现什么作用

13
akalius 学生认证  发表于 2017-3-27 08:42:42
sonypam 发表于 2017-3-27 07:51
其实只是最后输出OutTable数据集中重新整理好顺序,你可以试试在SQL中把排序语句去掉看看结果。
去掉之后不行呢    所以有些好奇

14
sonypam 在职认证  发表于 2017-3-27 08:55:34
去掉之后OutTable也是同样的24条record,只是顺序乱了,这就是为什么在main和auxi中各加一个index,多对多merge之后还能按照原来的顺序排好。下面是去掉order语句之后的sql code:

proc sql;
        create table OutTable(drop=index1) as
        select main.*, auxi.vara, auxi.varb
        from main, auxi
        where main.comb = auxi.comb and main.year = auxi.year and main.qtr = auxi.qtr;
/*         order by main.index1, auxi.index2; */
quit;

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

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-25 14:52