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 (July 1996, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 22 Jul 1996 09:49:57 -0700
Reply-To:   Dmitry Mesyanzhinov <dmes@EC26.ENRG.LSU.EDU>
Sender:   "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:   Dmitry Mesyanzhinov <dmes@EC26.ENRG.LSU.EDU>
Organization:   Louisiana State University InterNetNews Site
Subject:   SUM: Q: How to Rearrange Variables?

Original question: > When I run proc means or contents on my dataset, > variables appear in the order in which they were created. > There are about 300 variables in the dataset, > and it would be more convinient if the listing is > done in, say, alphabetical order. I tried to specify > the desired sequence of variables in the KEEP option, > but that didn't work. > Is there a way to rearrange the variables in a dataset?

Many thanks to:

Paul Rutz <prutz@tcada.state.tx.us> Ronald W. Manley <JAN7089@VM1.ucc.okstate.edu> ay987@freenet.carleton.ca (Frank Schnekenburger) burchil@cpe.umanitoba.ca (Charles Burchill)

who responded to my question.

Solution: Although there are several ways to change the order of the variables in a dataset, the easiest one is to use RETAIN in the DATA statement, e.g.,

data test; retain c b a; /* list variables in desired order */ set test; run;


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