@Quentin wrote:
Again, I wouldn't use DOSUBL. I would much prefer using a format, join, or hash table. But DOSUBL is interesting in what it can do.
@SASAlex101 thanks for taking the time to mark a correct answer. Just want to be clear that my DOSUBL answer is only "correct" in that it shows how DOSUBL timing differs from CALL EXECUTE timing, and can make this approach work (for a tiny dataset).
But if you're worried about the SQL join being slow, or a hash table running out of memory, that would suggest you've got big data.
DOSUBL is a useful tool to have in the toolbox for certain scenarios, but it's also painfully slow (because it does a LOT of work to create and destroy the "side-session"). I increased your input dataset Table1 to have 100,000 records and hit run, but got tired of waiting. Then I tried it with 10,000 records and got tired. Finally I tried 900 records, and it completed in 150 seconds. So for even small data, calling DOSUBL for every record might give you an answer, but it will be painfully slow, and while I'm not usually one to worry about efficiency, this approach is so slow that it's hard to call it "correct."
... View more