There you go again. What is your problem with RETAIN? So, you wrote a program once upon a time that didn't work because you don't understand RETAIN and now you have a vendetta against the poor defenseless RETAIN statement. I’m sorry but the statement “RETAIN should be avoided” sounds ridiculous to me.
What other SAS statements or procedures do you avoid?
Scan the forum archives - we've been down this path before, but not again.
No question that there are very specific opportunities to use a RETAIN statement, mostly to iterate a DATA step maintaining a "unique named" SAS variable across a step RETURN/DELETE, either explicit or implicit.
If you choose, enjoy using the RETAIN statement to your heart's content.
To do so, unless the need calls for it, is an opportunity for problems with SAS application program maintenance -- obviously my personal opinion.
were you aware that most variables read into a data step will naturally (and unavoidably) RETAIN?
That excludes only new columns derived in a step (created via assignment or input).
(but it does not exclude variables which are named on statement options, like filevar= and in= )
So a proper understanding of RETAIN is possibly (or probably) an "essential" for SAS training. (imho)
Given that proper understanding (and respect), I see no reason to propose avoiding the RETAIN statement as a sensible technique for arranging column order.
(I have probably learned a lot from tripping up over my mistakes, like non-use of RETAIN).
.... just my $0.02