[英]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;
我想做類似上面的事情。 當變量secid具有出現在名為“secids”的表中的值時,創建一個獲取數據的表。 由於我想要的值大約是600,我不能用於(100,101等)。 我需要以某種方式從另一個表中提取這些值。
任何幫助都會非常感激,因為我不是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;
請注意 - 退出!
嘗試這個:
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;
注意:基本上,Join比子查詢更快。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.