[英]How to use proc sql in sas and the in statement from another table
proc sql;
create table X as
select a.date, a.exdate
from optionm.opprcd as a
where a.volume>0
and a.secid in (secids);
quit;
I want to do something like the above. 我想做类似上面的事情。 Create a table taking data when the variable secid has values that appear in a table called "secids". 当变量secid具有出现在名为“secids”的表中的值时,创建一个获取数据的表。 Since the values that I want are approximately 600 I cannot use in (100, 101, etc). 由于我想要的值大约是600,我不能用于(100,101等)。 I need to somehow extract these values from another table. 我需要以某种方式从另一个表中提取这些值。
Any help would be much appreciated, since I am not an expert in SAS. 任何帮助都会非常感激,因为我不是SAS的专家。
proc sql;
create table X
as select
a.date,
a.exdate
from optionm.opprcd as a
where a.volume>0
and a.secid in (select /*column*/secid from /*table*/secids)
;quit;
note - quit! 请注意 - 退出!
Try this: 尝试这个:
proc sql;
create table X as
select a.date, a.exdate
from optionm.opprcd as a,sec_tab b
where a.secid=b.secids and a.volume>0;
quit;
NOTE: Basically, Join is faster than subquery. 注意:基本上,Join比子查询更快。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.