楼主: yunnandlg
1367 4

[学习分享] 同样的结果 那个更有效率 [推广有奖]

版主

但问耕耘,莫问收获

已卖:3032份资源

院士

5%

还不是VIP/贵宾

-

威望
0
论坛币
279367 个
通用积分
649.6470
学术水平
1667 点
热心指数
1686 点
信用等级
1650 点
经验
192122 点
帖子
1938
精华
0
在线时间
2780 小时
注册时间
2010-8-28
最后登录
2025-12-23

楼主
yunnandlg 在职认证  学生认证  发表于 2016-6-12 22:34:52 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
proc sort data=DSdata._Benchmark1;by date;run;
proc sort data=DSdata._all2;by date;run;
方法一
proc sql;
create table DSdata._all1_Benchmark as
select a.*,b.BDR,b.BLR
from DSdata._all2(rename=(n=nid Date=Date)) as a inner join DSdata._Benchmark1 as b on a.date=b.date ;
quit;


方法二
data DSdata._all1_Benchmark;
    merge DSdata._all2 (in=a) DSdata._Benchmark1(in=b);
          by  date;
            if a=1 and b=1;
          rename n=nid;
run;

二维码

扫码加我 拉你入群

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

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

关键词:有效率 inner join benchmark proc sql rename

回帖推荐

l1i2n3i4n5g 发表于4楼  查看完整内容

Well, that depends on your data and what you mean by “efficient”. You have to know the following: • the relationship between the tables • the sparseness or density of matches • the size of the tables • the availability of an index or sort flag When data sets are large and unsorted, the SQL inner join might outperform SORT and MERGE. If you have a long series of SO ...
Cause morning rolls around and it's another day of sun.
清晨不久就会来到,又是阳光明媚的一天。

沙发
nielei5515 发表于 2016-6-12 22:48:17 来自手机
yunnandlg 发表于 2016-6-12 22:34
proc sort data=DSdata._Benchmark1;by date;run;
proc sort data=DSdata._all2;by date;run;
方法一
这是什么软件

藤椅
yunnandlg 在职认证  学生认证  发表于 2016-6-12 22:54:02
nielei5515 发表于 2016-6-12 22:48
这是什么软件
SAS 系统

板凳
l1i2n3i4n5g 在职认证  发表于 2016-6-14 09:23:51

Well, that depends on your data and what you mean by “efficient”. You have to know the following:
• the relationship between the tables
• the sparseness or density of matches
• the size of the tables
• the availability of an index or sort flag
When data sets are large and unsorted, the SQL inner join might outperform SORT and MERGE. If you have a long
series of SORT and DATA steps, the SQL inner join might be easier to code and read.
In most cases, a DATA step MERGE statement generally outperforms an SQL outer join, even taking sort resources
into account.
One exception is a very sparse match join when you only want the observations with matching key values.

A Guide to Efficient PROC SQL Coding.pdf
下载链接: https://bbs.pinggu.org/a-2050048.html

2.92 MB

A Guide to Efficient PROC SQL Coding

已有 1 人评分论坛币 热心指数 收起 理由
admin_kefu + 40 + 2 鼓励积极发帖讨论

总评分: 论坛币 + 40  热心指数 + 2   查看全部评分

报纸
yunnandlg 在职认证  学生认证  发表于 2016-6-14 10:43:27
l1i2n3i4n5g 发表于 2016-6-14 09:23
Well, that depends on your data and what you mean by “efficient”. You have to know the following ...
谢谢分享。

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

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