Yeah, it's pretty sad - thanks for saying it for everyone else. I
personally use 'retain' before the 'set/merge/etc' statement to reorder the
variables in the PDV. As I mentioned to respondent silver0514@MY-DEJA.COM
privately, why would I choose a simple solution when I could clutter up my
SAS program with a cumbersome (and seemingly sloppy) macro solution? <grin>
Here's hoping that SI macro did indeed come from the SI marketing folks...
> From: WHITLOI1@westat.com[SMTP:WHITLOI1@westat.com]
> Sent: Wednesday, December 15, 1999 3:49 PM
> To: Shostak, Jack; SAS-L@LISTSERV.UGA.EDU
> Subject: Shocking State of SI SAS Programming in SAS communications (
> Subject: Ordering variables in data step
> Summary: Shocking state of SI SAS Programming in SAS Communications
> Respondent: Ian Whitlock <email@example.com>
> In response to Dustin Eastwood's question on how to order the
> variables in a SAS data set, Jack Shostak <shost001@ONYX.DCRI.DUKE.EDU>
> > Check out SAS Communications 4th Quarter 1999 p56 (or
> > ) for a generic approach with a SAS macro. The example is
> > limited to 5 variables but can be easily extended.
> Thanks Jack for pointing out the article. I was surprised to find the
> following problems with the published macro.
> 1) The REORDER macro does not work with character data!
> 2) It is needlesly limited to 5 variables.
> 3) 50% of the 41 line macro performs two steps that are not needed.
> 4) A macro was coded inside another macro. (It may work but is in
> rather poor taste.)
> To appreciate just how baddly designed this macro is, I point out
> that the following 8 line macro accomplishes the same thing without
> creating an extra data set, TEMP. (An 80% reduction in code.)
> %macro reorder(dataset, init) ;
> data &dataset ;
> if 0 then put &init ;
> set &dataset ;
> run ;
> %mend reorder ;
> The macro still does not handle character data correctly, but it
> could by simply replacing "IF 0 THEN PUT" with "RETAIN".
> It is too bad that on the eve of the millenium and the introduction
> of a really nice product, SAS version 8, the sales department must
> take over with this trash.
> On a personal note of irony, Dustin was pulled from my December SAS
> class. Had he been able to take the third day, he would not have
> asked the question.
> Ian Whitlock