对于 in 语句,它们如何在 SAS 中针对两个不同的变量工作?
With in statements how do they work in SAS for two different variables?
我想在 SAS 中使用 with in 语句,但我不确定它如何在带日期的 where 语句中处理两个变量。
谁能对最后一行代码提出建议?
proc sql;
create table work.users as
select t1.age
t1.ID
t1.DateTime1
t2.DateTime2
from work.database.table t1
left join work.users2 on datepart(t1.Datetime1) is within 2 days datepart(t2.DateTime2)
谢谢!
正如 david25272 在他的评论中所说,within
在 SAS 中不起作用。您将不得不使用 between
:
proc sql;
create table work.users as
select t1.age
t1.ID
t1.DateTime1
t2.DateTime2
from work.database.table t1
left join work.users2
on datepart(t1.Datetime1) between datepart(t2.DateTime2)-2 and datepart(t2.DateTime2)+2
quit;
我想在 SAS 中使用 with in 语句,但我不确定它如何在带日期的 where 语句中处理两个变量。 谁能对最后一行代码提出建议?
proc sql;
create table work.users as
select t1.age
t1.ID
t1.DateTime1
t2.DateTime2
from work.database.table t1
left join work.users2 on datepart(t1.Datetime1) is within 2 days datepart(t2.DateTime2)
谢谢!
正如 david25272 在他的评论中所说,within
在 SAS 中不起作用。您将不得不使用 between
:
proc sql;
create table work.users as
select t1.age
t1.ID
t1.DateTime1
t2.DateTime2
from work.database.table t1
left join work.users2
on datepart(t1.Datetime1) between datepart(t2.DateTime2)-2 and datepart(t2.DateTime2)+2
quit;