Thank you for your reply. I am just posting here so people are aware of the bug. It's quite pernicious imo. call execute() is not a flawed approach. It is in fact the most elegant approach (if not for the bug described here). By elegant I mean it needs the fewest lines of code. The drawback with mstored is that “%syslput _user_;” is not available in 9.2, so more code is needed to hunt down all of the user’s macro variables. Imagine a dynamic environment where the users do whatever they want. (By "users" I really mean other programmers.) To give you a bit more background, my code is generated through a data step based on user input and a very complex logic. Each step, when generated, is inserted into a hash table (so they don't have to be generated in the same order as the actual execution). In the end of the data step, a hiter loop is used and call execute() is applied. As for %foo, I concocted it just to demonstrate the bug. I don't really need one thousand x's. If you have code that's written as state = "New York", the bug would have SAS run state = "New York" instead (note the double spaces between New and York). No rewriting can avoid getting the wrong output in that case.
... View more