Date: Wed, 22 Sep 2010 01:14:25 -0400
Reply-To: David Marso <david.marso@GMAIL.COM>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: David Marso <david.marso@GMAIL.COM>
Subject: Re: AW: Stacking data to left - restructure query
Content-Type: text/plain; charset=ISO-8859-1
Hello,
In a similar spirit but omitting much unnecessary code.
VECTOR BK(7).
COMPUTE #=1.
DO REPEAT B=B1 TO B7.
+ DO IF NOT MISSING(B).
+ COMPUTE BK(#)=B.
+ COMPUTE #=#+1.
+ END IF.
END REPEAT.
LIST.
HTH, David
On Tue, 21 Sep 2010 12:49:58 +0200, la volta statistics
<schmidhauser@lavolta.ch> wrote:
>Hi Mark
>
>
>
>You could use the following syntax for your example:
>
>In order do use the Do Repeat � End Repeat code for making the new vars, I
>have changed the names of the new vars from b1x to bx1 etc.
>
>
>
>Hope this helps,
>
>Christian
>
>
>
>Do repeat R = bx1 to bx7.
>
>Numeric R.
>
>End repeat.
>
>
>
>Vector a = b1 to b7.
>
>Vector b = bx1 to bx7.
>
>Compute #i = 1.
>
>
>
>Loop #k = 1 to 7.
>
>+ Do if Not Missing (a(#k)).
>
>+ Compute b(#i) = (a(#k)).
>
>+ Compute #i = #i + 1.
>
>+ End if.
>
>End Loop.
>
>Exec.
>
>
>
>
>
>**********************************
>la volta statistics
>
>Christian Schmidhauser, Dr.phil.II
>Weinbergstrasse 108
>CH-8006 Z�rich
>Tel: +41 (043) 233 98 01
>Fax: +41 (043) 233 98 02
>email: <mailto:schmidhauser@lavolta.ch> mailto:schmidhauser@lavolta.ch
>Web: www.lavolta.ch
>
>
>
> _____
>
>Von: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] Im Auftrag von
>Mark Webb
>Gesendet: Dienstag, 21. September 2010 11:30
>An: SPSSX-L@LISTSERV.UGA.EDU
>Betreff: Fwd: Stacking data to left - restructure query
>
>
>
>
>I want to stack data to the left of a set of variables.
>Below is an example of what format I have and what I want.
>Any ideas ?
>
>
>
>
>
>Have
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>b1
>
>b2
>
>b3
>
>b4
>
>b5
>
>b6
>
>b7
>
>
>.
>
>.
>
>.
>
>4
>
>.
>
>.
>
>.
>
>
>1
>
>2
>
>.
>
>.
>
>.
>
>6
>
>.
>
>
>.
>
>.
>
>3
>
>4
>
>.
>
>.
>
>.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>Want
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>b1x
>
>b2x
>
>b3x
>
>b4x
>
>b5x
>
>b6x
>
>b7x
>
>
>4
>
>.
>
>.
>
>.
>
>.
>
>.
>
>.
>
>
>1
>
>2
>
>6
>
>.
>
>.
>
>.
>
>.
>
>
>3
>
>4
>
>.
>
>.
>
>.
>
>.
>
>.
>
>
>
>
>
>--
>Mark Webb
>
>Line +27 (21) 786 4379
>Cell +27 (72) 199 1000
>Fax to email +27 (86) 5513075
>Skype webbmark
>Email tomarkwebb@gmail.com
>===================== To manage your subscription to SPSSX-L, send a message
>to LISTSERV@LISTSERV.UGA.EDU (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
LISTSERV@LISTSERV.UGA.EDU (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
|