在 PROC SQL (SAS) 中声明变量
declare variabe in PROC SQL (SAS)
我正在尝试在 PROC SQL 上使用变量,但我无法通过 Internet 找到合适的方法。我只想在 PROC SQL:
上应用以下 T-SQL 代码
declare @example as int;
set @example=2;
select * from {table} where {column}=@example;
go
如何在 PROC SQL 上应用此代码?
SAS SQL 的翻译是使用宏变量,代码看起来很相似,但需要将其包装在 PROC SQL 块中。
%let example=2;
proc sql;
select *
from table
where variable=&example;
quit;
编辑:我对宏变量的原始引用不正确,在 SAS 中使用符号而不是 @ 符号。
我正在尝试在 PROC SQL 上使用变量,但我无法通过 Internet 找到合适的方法。我只想在 PROC SQL:
上应用以下 T-SQL 代码 declare @example as int;
set @example=2;
select * from {table} where {column}=@example;
go
如何在 PROC SQL 上应用此代码?
SAS SQL 的翻译是使用宏变量,代码看起来很相似,但需要将其包装在 PROC SQL 块中。
%let example=2;
proc sql;
select *
from table
where variable=&example;
quit;
编辑:我对宏变量的原始引用不正确,在 SAS 中使用符号而不是 @ 符号。