In oracle, I can say:
for h in (select id from tbl where ....) loop
...
any processing needed for h.id, updating, deleting from other tables, sending notifications, aggregate data from other tables, etc. It essentially lets me do multiple and/or conditional data steps/sql blocks from within a data step.
...
end loop
In SAS, you would have to (or at least the best way I've figured out how to):
1. create a dataset tbl with a monotonic column (say rownum) using proc sql with monotonic() or a data step with the _N_ auto variable
2. count how many rows where in the table and store it in a macro variable (say %totrows)
3. build a macro to run a loop and use proc sql to get variables;
...
%do i = 1 to %totrows;
proc sql;
select id into :id from tbl where .... and rownum = &i;
---
any processing needed for that id
...
'%end;
... View more