LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (December 1999, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 16 Dec 1999 07:36:07 -0500
Reply-To:   "Shostak, Jack" <shost001@ONYX.DCRI.DUKE.EDU>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Shostak, Jack" <shost001@ONYX.DCRI.DUKE.EDU>
Subject:   Re: Shocking State of SI SAS Programming in SAS communications (
Comments:   To: "WHITLOI1@westat.com" <WHITLOI1@westat.com>
Content-Type:   text/plain

Ian, 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...

Ian wrote: > ---------- > 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 <whitloi1@westat.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> > wrote: > > > Check out SAS Communications 4th Quarter 1999 p56 (or > > > >http://www.sas.com/service/doc/periodicals/sascomm/4q99/27208_US_p54to56_ > 1299.p > df > > > > ) 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 >


Back to: Top of message | Previous page | Main SAS-L page