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 (March 2002, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 15 Mar 2002 16:45:08 -0500
Reply-To:   "Elmaache, Hamani" <Hamani.Elmaache@CCRA-ADRC.GC.CA>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Elmaache, Hamani" <Hamani.Elmaache@CCRA-ADRC.GC.CA>
Subject:   Re: How change variable's order in a sas dataset?
Comments:   To: Robert Abelson <rabelson@KAI-RESEARCH.COM>
Content-Type:   text/plain; charset="iso-8859-1"

Hi Dianne Use this example: /************************/

data x1; input var1 var2 var3; datalines; 1 2 4 1 4 4 4 3 6 7 5 9 ; run; title; title1 " data x1 "; proc print data=x1; run;

/* in data x1 the order of variables is: var1 var2 var3 */ /* suppose you wante them in oder: var1 var3 var2 */

proc sql; create table x2 as select var1 ,var3, var2 from x1; quit; title2 " data x2 "; proc print data=x2; run;

/****************************/ Barrere.

-----Original Message----- From: Robert Abelson [mailto:rabelson@KAI-RESEARCH.COM] Sent: March 15, 2002 4:28 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: How change variable's order in a sas dataset?

As I recall, at one time PROC SORT wouldn't work if any of the BY variables was past a certain position in the dataset. That's when I first learned about using RETAIN to reorder the variables in the dataset (around 1985 IIRC). Obviously, SAS has improved PROC SORT so that this is no longer the case.

Bob Abelson KAI 6001 Montrose Rd. Suite 920 Rockville, MD 20852 T: 301-770-2730 F: 301-770-4183 rabelson@kai-research.com

> -----Original Message----- > From: Dianne Rhodes [SMTP:RHODESD1@WESTAT.COM] > Sent: Friday, March 15, 2002 4:17 PM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Re: How change variable's order in a sas dataset? > > >IanWhitlock@westat.com wrote: > > > >Thus it is very likely that use of RETAIN to reorder > >variables goes back to > >the beginning of SAS. > > > Yes, that is what I was taught in 1978. > However some of the other features of RETAIN have changed a good bit. > The statement that I learned was that RETAIN is not executable and can > appear anywhere in the datastep. This is true, with the exception of > RETAIN > _ALL_ > Then the position matters. > > I recall that I frequently used this feature as a Research Assistant at > Urban Institute (1980-1982) when I > wanted to sort a large file on the MainFrame, to move the variable I was > sorting on to the beginning of the file > to make the sort run faster. That would have been at Dial Tyme under > SuperWylbur. > > > Dianne Louise Rhodes > Sr. Systems Analyst > Westat


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