|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?|
> 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 <email@example.com>
Ronald W. Manley <JAN7089@VM1.ucc.okstate.edu>
firstname.lastname@example.org (Frank Schnekenburger)
email@example.com (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.,
retain c b a; /* list variables in desired order */