@PGStats
I agree that "reading" a data set twice risks excessive use of disk input activity, and therefore should be avoided, as your program does. But just to be clear, the presence of both a SET and a MERGE statement in the program I suggested should not represent much increased disk input activity, because of how the operating system satisfies disk input requests.
Because the SET and MERGE are tightly synchronized in this program, they are reading from the same disk page. So once a page of data is put in memory by the operating system, both the SET and MERGE will populate the program data vector from that memory page. So yes, there are two streams of data established in the program, but the impact on actual resource use should be minimal. I haven't tested this understanding for quite a while, but I'd be surprised if there would be much increase in disk transfers in the example I suggested.
I appreciate you raising the issue. I should have put a caveat with my program, because I'm sure that many sas users would see my code as having the same resource impact as two independent complete loops through the data - one for the SET, and one for the MERGE.
... View more