In reply to Leonid Batkhan.

Hi Leonid,

Thank you! I'm in the (sub-optimal) habit of using an IF _N_ = 1 block to visually corral anything that isn't meant to execute with each iteration of the data step, whether declarative or executable. I hadn't even considered initializing those variables in the retain statement, and will definitely be adding that to my arsenal.

As far as the single quotes in the outfile variable, I don't have those there for SAS but for z/OS, to indicate that it's a fully qualified path and prevent z/OS from prefixing the variable value with the username of the person running the program. It's just another of the vagaries of programming in a local SAS session on Windows, to connect to and execute code in a remote SAS session on the mainframe.

I'm going to check out your post on conditionally executing global statements; I'm very curious to know if your method resembles mine. I have code that conditionally specifies which external code to include. The conditional logic assigns the appropriate path to the fileref nextsas, and after the code block is closed out, the include statement calls whichever file's path is assigned to nextsas. I haven't run into another circumstance where I need to do that, and based on what I've seen of your code so far, I expect you've got more examples.

Best,
Rebekah