Date: Tue, 7 Jan 1997 13:34:04 -0600
Reply-To: Thomas Kalfas <kalfast@PPRD.ABBOTT.COM>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Thomas Kalfas <kalfast@PPRD.ABBOTT.COM>
Subject: Re: Changing the order of vars in a dataset
In-Reply-To: "Cates, Randall C"
<rccates@mkg.com> "Changing the order of vars in a dataset" (Jan
7, 12:32pm)
Content-Type: text/plain; charset=us-ascii
Randy,
I remember being able to do this with a KEEP statement prior to the SET
statement in version 5.??; however, this has seemed to have changed over the
versions. I know that you can now use PROC TRANSPOSE's COPY statement to do
the same thing. For example:
proc transpose data=<whatever> out=<whatever>(keep=<variable list>);
copy <variable list in order of preference>;
run;
Be sure to use the KEEP dataset option on your output dataset; otherwise, you
will also get the _NAME_ variable and a bunch of COL# variables (i.e. one for
every observation in the dataset). It is not necessary to list the variables
in the order of preference in the KEEP dataset option...only in the COPY
statement.
This is a short and not-so-sweet method...there should be a "purer" way of
achieving this effect.
HTH,
Tom
===================================================
On Jan 7, 12:32pm, Cates, Randall C wrote:
> Subject: Changing the order of vars in a dataset
> Hey all in SAS-Land
>
> Here's an annoying little thing that I know I knew but don't now know. I
> am creating datasets to output the specific data to MS-Excel (ours not to
> reason why ...). I'll be doing it with SAS/ACCESS for ODBC but I need to
> make sure that the datasets have the variables in specific orders (id vars
> first, date vars, etc.), so that I don't have to futz about with the Excel
> spreadsheets afterwards.
>
> My question is: Is there a good easy way to re-order variables when
> creating output datasets? I thought that I could do it with a keep
> statement but that doesn't do the trick.
>
> Any ideas out there?
>
> Thanks in advance.
>
> Randy Cates, SAS Consultant
> Arbor Consulting Resources, Inc.
> rccate@mkg.com (alternate randycates@msn.com)
>-- End of excerpt from Cates, Randall C
--
Thomas Kalfas
System Developer
Abbott Laboratories
E-mail: kalfast@pprd.abbott.com
Phone: (847) 938-8101
Fax: (847) 935-1320
|