楼主: daie3000
10239 13

求助:能否在SAS循环语句中嵌入SQL语句?? [推广有奖]

11
rockfido 在职认证  发表于 2010-7-10 21:31:11
5# pobel

great idea!!

12
zhukovasky 发表于 2012-11-30 17:25:31
pobel 发表于 2010-7-8 16:27
data _null_;
   call execute("Proc sql;");
   do age=11 to 15;
膜拜中
za rujina!

13
kittyforever 发表于 2013-1-16 15:06:28
学习

14
dyan 发表于 2013-1-18 12:21:12
可以通过 call execute 实现:
例如:
data _null_;
set A;
this_date = effect_date;
call execute("proc sql;");
call execute("create table temp1 as select * from TABLE1  a where a.effect_date"||
  " = (select max(b.effect_date) from TABLE1 b where b.effect_date<=" ||this_date||");");
call execute("create table temp2 as select * from TABLE2 a where a.effect_date "||
  " = (select max(b.effect_date) from TABLE2 b where b.effect_date<=" ||this_date||");");
call execute("create table temp3 as select b.code, a.weight as weight1, b.weight as weight2"||
   " from temp2 b full join temp1 a on a.code=b.code;");
call execute("quit;");
call execute("data temp3; set temp3; effect_date ="||this_date||"; run;");
call execute("proc append out=compare data = temp3;run;");
run;

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

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