Date: Thu, 21 Sep 2006 05:21:21 -0700
Reply-To: Albert-jan Roskam <firstname.lastname@example.org>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Albert-jan Roskam <email@example.com>
Subject: Re: Moving varaibles using syntax
Content-Type: text/plain; charset=iso-8859-1
The following code is based on Ray's method or
re-arranging a data set.
define alfabet (dir = !charend ('/') / oldnam =
set mprint = on.
file handle inf/name= !dir + !oldnam.
n of cases 1.
sort cases by case_lbl.
!let !oldnam2 = !unquote(!oldnam).
!let !newsps =
do if $casenum=1.
write outfile=!newsps /"get file=inf/keep=".
write outfile=!newsps /" " case_lbl.
variable alignment all (center).
save outfile = !dir +
set mprint = off.
** macro call(s).
** new sav file (with the prefix 'reorder--') is in
** Syntax is saved in d:\temp.
!alfabet dir = "D:\temp\" / oldnam =
--- Melissa Ives <firstname.lastname@example.org> wrote:
> I am assuming that by 'row #' you mean the row in
> the Variable View. I
> am also assuming that by requesting this in syntax,
> simply dragging the
> variable over to where you want it is not the
> solution you prefer.
> The way we usually reorder variables is with a save
> command that
> 'overwrites' the current dataset, then re-open it.
> SAVE OUTFILE='C:\myfile.sav'/keep=var1 to var14
> var16 to var35 var15
> var36 to varn.
> GET FILE='C:\myfile.sav'.
> You can drop in the list of variables using the
> variables icon if that
> is easier. You can also specify exactly the order
> of each individual
> variable or use the 'to' command to include multiple
> vars at once.
> -----Original Message-----
> From: SPSSX(r) Discussion
> [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of
> Jignesh Sutar
> Sent: Wednesday, September 20, 2006 10:30 AM
> To: SPSSX-L@LISTSERV.UGA.EDU
> Subject: Re: [SPSSX-L] Moving varaibles using syntax
> Still struggling to try find a solution to the exact
> How does one move a variable which is in row 15
> initially to row 36??
> (by syntax)
> On 20/09/06, ariel barak <email@example.com>
> > Jignesh,
> > I found how to do this myself two days ago after
> finding the topic
> > covered on Raynald's SPSS Tools site. Here is the
> syntax below...
> > * How to delete or reorder variable names.
> * Raynald Levesque
> > 2002/02/09.
> DATA LIST LIST /id sex var1 z age.
> BEGIN DATA
> 1 1 1 1 25
> 2 2 2
> > 2 35
> 3 1 5 0 65
> END DATA.
> * TO change the order to the variables to age id
> > sex var1 z.
> MATCH FILES FILE=* /KEEP=age ALL.
> * NOTE: In the above
> > command, ALL means all remaining variables not
> previously named.
> * Use the
> > following to delete variables var1, z and age.
> MATCH FILES FILE=* /DROP=var1
> > z age.
> > On 9/20/06, Jignesh Sutar <firstname.lastname@example.org
> > wrote:
> > > Hello,
> > >
> > > Is it possible to move variable position using
> syntax? Using SPSS
> > > v15
> > >
> > > Thanks in advance
> > > Jignesh
> > >
> PRIVILEGED AND CONFIDENTIAL INFORMATION
> This transmittal and any attachments may contain
> PRIVILEGED AND
> CONFIDENTIAL information and is intended only for
> the use of the
> addressee. If you are not the designated recipient,
> or an employee
> or agent authorized to deliver such transmittals to
> the designated
> recipient, you are hereby notified that any
> copying or publication of this transmittal is
> strictly prohibited. If
> you have received this transmittal in error, please
> notify us
> immediately by replying to the sender and delete
> this copy from your
> system. You may also call us at (309) 827-6026 for
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around