A few things wrong here. 1 - you're changing the value of macvar i. This is set/automatically incremented by SAS as part of the %do ... %to... . So you don't need to initialise it to 1, SAS does it, but this won't have caused a problem. You must not change the value yourself. When you increment it at the end of the loop, SAS does it again as well - so you go in with 1, second time around with your and SAS' increments it goes in with value 3, not the 2 you're expecting. So you'll only process every other value in the parameter lists. 2 - labtabs empty - not clear what's happening here. First suspect is the IF statement. Comment it out and see what happens. Case (suggested above) is a good starting point. You may also need to left align the variable. It's also possible that the macro variable ¶mlist used to supply ¶m is empty, we can't see from what you've posted. However if the variable lparm exists on both datasets and is empty in data2 or contains a value in data2 that doesn't correspond to ¶m, it'll always fail, as the righthand dataset value will overwrite the left hand dataset value. Another culprit could be the values in variable pt, especially if data1 and data2 aren't sorted by pt.
... View more