|
Dear spssxl listserv,
I'd like to know how to re-order SPSS variables in the following way: From this varibale list: a1 b1 c1 ... a50 b50 c50 into the varibale list: a1 a2 a3...a50 b1 b2 b3...b50 c1 c2 c3 ... c50 Does anybody know syntax for perfomring that? Any help would be much appreciated. (It's for using a vector command afterwards, as I assume that the variables making up a vector need to be in a row - I've found that otherwise it doesn't work). Thanks! Russell ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
A) Resave the file with an explicit Keep list in desired order .
It is advisable to never save over top the original file so give it a different name. SAVE Outfile= 'myfile2' /Keep= ID a1 a2 a3 b1 b2 b3 c1 c2 c3 . B) Alternatively, switch order that the fields are read initially using /Keep . GET File= 'myfile' /Keep= ID a1 a2 a3 b1 b2 b3 c1 c2 c3 . Dennis Deck, PhD RMC Research Corporation 111 SW Columbia Street, Suite 1200 Portland, Oregon 97201-5843 voice: 503-223-8248 x715 voice: 800-788-1887 x715 fax: 503-223-8248 [hidden email] -----Original Message----- From: Russell Deighton [mailto:[hidden email]] Sent: Wednesday, June 25, 2008 8:33 PM Subject: reordering data Dear spssxl listserv, I'd like to know how to re-order SPSS variables in the following way: From this varibale list: a1 b1 c1 ... a50 b50 c50 into the varibale list: a1 a2 a3...a50 b1 b2 b3...b50 c1 c2 c3 ... c50 Does anybody know syntax for perfomring that? Any help would be much appreciated. (It's for using a vector command afterwards, as I assume that the variables making up a vector need to be in a row - I've found that otherwise it doesn't work). Thanks! Russell ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
Sure. It's actually rather easy.
flip. sort by case_lbl (a). flip. del var case_lbl. There you go. Try it. Elaine On Wed, Jun 25, 2008 at 11:20 PM, Dennis Deck <[hidden email]> wrote: > A) Resave the file with an explicit Keep list in desired order . > It is advisable to never save over top the original file so give it a > different name. > > SAVE Outfile= 'myfile2' > /Keep= ID a1 a2 a3 b1 b2 b3 c1 c2 c3 . > > B) Alternatively, switch order that the fields are read initially using > /Keep . > > GET File= 'myfile' > /Keep= ID a1 a2 a3 b1 b2 b3 c1 c2 c3 . > > > Dennis Deck, PhD > RMC Research Corporation > 111 SW Columbia Street, Suite 1200 > Portland, Oregon 97201-5843 > voice: 503-223-8248 x715 > voice: 800-788-1887 x715 > fax: 503-223-8248 > [hidden email] > > -----Original Message----- > From: Russell Deighton [mailto:[hidden email]] > Sent: Wednesday, June 25, 2008 8:33 PM > Subject: reordering data > > Dear spssxl listserv, > > I'd like to know how to re-order SPSS variables in the following way: > > From this varibale list: > > a1 b1 c1 ... a50 b50 c50 > > into the varibale list: > > a1 a2 a3...a50 b1 b2 b3...b50 c1 c2 c3 ... c50 > > Does anybody know syntax for perfomring that? Any help would be much > appreciated. > > (It's for using a vector command afterwards, as I assume that the variables > making up a vector need to be in a row - I've found that otherwise it > doesn't work). > > Thanks! > Russell > > ===================== > To manage your subscription to SPSSX-L, send a message to > [hidden email] (not to SPSSX-L), with no body text except the > command. To leave the list, send the command > SIGNOFF SPSSX-L > For a list of commands to manage subscriptions, send the command > INFO REFCARD > -- Elaine LaBorde [hidden email] 512-668-4253 515-474-5188 fax ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
In reply to this post by R Deighton
Oh wait! I left out a word, sorry!
flip. sort *cases* by case_lbl (a). flip. del var case_lbl. Elaine On Wed, Jun 25, 2008 at 10:33 PM, Russell Deighton <[hidden email]> wrote: > Dear spssxl listserv, > > I'd like to know how to re-order SPSS variables in the following way: > > From this varibale list: > > a1 b1 c1 ... a50 b50 c50 > > into the varibale list: > > a1 a2 a3...a50 b1 b2 b3...b50 c1 c2 c3 ... c50 > > Does anybody know syntax for perfomring that? Any help would be much > appreciated. > > (It's for using a vector command afterwards, as I assume that the variables > making up a vector need to be in a row - I've found that otherwise it > doesn't work). > > Thanks! > Russell > > ===================== > To manage your subscription to SPSSX-L, send a message to > [hidden email] (not to SPSSX-L), with no body text except the > command. To leave the list, send the command > SIGNOFF SPSSX-L > For a list of commands to manage subscriptions, send the command > INFO REFCARD > -- Elaine LaBorde [hidden email] 512-668-4253 515-474-5188 fax ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
This is not an efficient solution for large files.
A really simple solution that doesn't require any explicit saving is to use MATCH FILES with only one file and use the KEEP subcommand. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Elaine LaBorde Sent: Thursday, June 26, 2008 9:56 AM To: [hidden email] Subject: Re: reordering data Oh wait! I left out a word, sorry! flip. sort *cases* by case_lbl (a). flip. del var case_lbl. Elaine On Wed, Jun 25, 2008 at 10:33 PM, Russell Deighton <[hidden email]> wrote: > Dear spssxl listserv, > > I'd like to know how to re-order SPSS variables in the following way: > > From this varibale list: > > a1 b1 c1 ... a50 b50 c50 > > into the varibale list: > > a1 a2 a3...a50 b1 b2 b3...b50 c1 c2 c3 ... c50 > > Does anybody know syntax for perfomring that? Any help would be much > appreciated. > > (It's for using a vector command afterwards, as I assume that the > making up a vector need to be in a row - I've found that otherwise it > doesn't work). > > Thanks! > Russell > > ===================== > To manage your subscription to SPSSX-L, send a message to > [hidden email] (not to SPSSX-L), with no body text except the > command. To leave the list, send the command > SIGNOFF SPSSX-L > For a list of commands to manage subscriptions, send the command > INFO REFCARD > -- Elaine LaBorde [hidden email] 512-668-4253 515-474-5188 fax ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
In reply to this post by Dennis Deck
If Elaine LaBorde's flip solution won't work due to a large file (per ViAnn), AND
If your variable list is in alphabetical order (you can set it to alphabetical using: Edit-->Options-->General tab-->variable list=alphabetical (not file order)), then you should be able to create a keep subcommand in syntax by clicking the variable list icon, highlighting all the variables in question (a1 a2 a3 b1 b2 b3) as they will be listed in this order and selecting paste. Melissa -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Dennis Deck Sent: Wednesday, June 25, 2008 11:21 PM To: [hidden email] Subject: Re: [SPSSX-L] reordering data A) Resave the file with an explicit Keep list in desired order . It is advisable to never save over top the original file so give it a different name. SAVE Outfile= 'myfile2' /Keep= ID a1 a2 a3 b1 b2 b3 c1 c2 c3 . B) Alternatively, switch order that the fields are read initially using /Keep . GET File= 'myfile' /Keep= ID a1 a2 a3 b1 b2 b3 c1 c2 c3 . Dennis Deck, PhD RMC Research Corporation 111 SW Columbia Street, Suite 1200 Portland, Oregon 97201-5843 voice: 503-223-8248 x715 voice: 800-788-1887 x715 fax: 503-223-8248 [hidden email] -----Original Message----- From: Russell Deighton [mailto:[hidden email]] Sent: Wednesday, June 25, 2008 8:33 PM Subject: reordering data Dear spssxl listserv, I'd like to know how to re-order SPSS variables in the following way: From this varibale list: a1 b1 c1 ... a50 b50 c50 into the varibale list: a1 a2 a3...a50 b1 b2 b3...b50 c1 c2 c3 ... c50 Does anybody know syntax for perfomring that? Any help would be much appreciated. (It's for using a vector command afterwards, as I assume that the variables making up a vector need to be in a row - I've found that otherwise it doesn't work). Thanks! Russell ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD 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 dissemination, 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 assistance. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
In reply to this post by Elaine LaBorde
Well that would be anonther way to do it with small files.
But it would be inadviseable with medium to large files - which I generally have. And it, of course, only works in cases with simple variable naming like his example. Dennis Deck, PhD RMC Research Corporation 111 SW Columbia Street, Suite 1200 Portland, Oregon 97201-5843 voice: 503-223-8248 x715 voice: 800-788-1887 x715 fax: 503-223-8248 [hidden email] <mailto:[hidden email]> ________________________________ From: Elaine LaBorde [mailto:[hidden email]] Sent: Thursday, June 26, 2008 8:51 AM To: Dennis Deck Cc: [hidden email] Subject: Re: reordering data Sure. It's actually rather easy. flip. sort by case_lbl (a). flip. del var case_lbl. There you go. Try it. Elaine On Wed, Jun 25, 2008 at 11:20 PM, Dennis Deck <[hidden email]> wrote: A) Resave the file with an explicit Keep list in desired order . It is advisable to never save over top the original file so give it a different name. SAVE Outfile= 'myfile2' /Keep= ID a1 a2 a3 b1 b2 b3 c1 c2 c3 . B) Alternatively, switch order that the fields are read initially using /Keep . GET File= 'myfile' /Keep= ID a1 a2 a3 b1 b2 b3 c1 c2 c3 . Dennis Deck, PhD RMC Research Corporation 111 SW Columbia Street, Suite 1200 Portland, Oregon 97201-5843 voice: 503-223-8248 x715 voice: 800-788-1887 x715 fax: 503-223-8248 [hidden email] -----Original Message----- From: Russell Deighton [mailto:[hidden email]] Sent: Wednesday, June 25, 2008 8:33 PM Subject: reordering data Dear spssxl listserv, I'd like to know how to re-order SPSS variables in the following way: From this varibale list: a1 b1 c1 ... a50 b50 c50 into the varibale list: a1 a2 a3...a50 b1 b2 b3...b50 c1 c2 c3 ... c50 Does anybody know syntax for perfomring that? Any help would be much appreciated. (It's for using a vector command afterwards, as I assume that the variables making up a vector need to be in a row - I've found that otherwise it doesn't work). Thanks! Russell ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD -- Elaine LaBorde [hidden email] 512-668-4253 515-474-5188 fax ====================To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
| Free forum by Nabble | Edit this page |
