2016-11-07 38 views
0

這裏是內部循環(用********標記)還是如此,還是需要使用類似%eval()的內容? (我不認爲我需要%的eval(),因爲沒有宏變量。)SAS數據步驟中的DO循環中的動態控制流程

do _i = 1 to 5; 
    if sp_id_array{_i} ne . then do; 
     do _j = (_i+1) to 5; *********; 
     if sp_id_array{_j} ne . then do; 
      sp_id = sp_id_array{_i}; 
      sp_partner_id = sp_id_array{_j}; 
      output; 
     end; 
     end; 
    end;   
end; 

回答

0

這很好; SAS會自動使用(_i+1)。實際上,您可以在循環內修改循環控制變量本身。

data _null_; 
    do _i = 1 to 5; 
    put _i=; 
    _i=5; 
    end; 
run;