Hi. You have to understand that no variable are created inside the datastep at runtime. Datastep is processed in two distinct phases, compile and runtime. It's at compile time that the layout(s) of the destination dataset(s) are defined, not at runtime. The interpreter will scan the code and allocate every variable referenced in the code (on a memory area known as Program Data Vector, or PDV, that will output entirely or partially to the destination dataset(s)), sometimes doing some assumptions about type and length of new variables that aren't what you expected, hence the use of LENGHT statement to guide SAS interpreter to the right assumptions. So when the code runs, everything is pretty well defined in terms of variables, lengths and types. In you're case the SAS interpreter has allocated a new variable (and defaulted to numeric size 😎 before the run time phase because it has seen the reference to it at compiler time. Hope the explanation is clear. Cheers from Portugal. Daniel Santos @ www.cgd.pt
... View more