Date: Mon, 3 Jul 2006 07:28:14 -0500
Reply-To: "Peck, Jon" <firstname.lastname@example.org>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: "Peck, Jon" <email@example.com>
Subject: Re: Stacking Variables Into a New Variable
Content-Type: text/plain; charset="iso-8859-1"
Transformation functions such as max, min, sum, and mean are smart enough to omit missing values. Otherwise they would be pretty much useless. That is why they have the optional form function.count(x,y,...) which produces a missing value result if there are not at least count nonmissing values in the arguments.
From: SPSSX(r) Discussion on behalf of Antoon Smulders
Sent: Mon 7/3/2006 3:14 AM
Subject: Re: [SPSSX-L] Stacking Variables Into a New Variable
Van: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] Namens Richard
Verzonden: vrijdag 30 juni 2006 0:13
Onderwerp: Re: Stacking Vartibles Into a New Variable
At 04:54 PM 6/29/2006, Gene Maguin wrote:
>This should do it.
>If (class eq 1) v44=v11.
>If (class eq 2) v44=v21.
>If (class eq 3) v44=v34.
It should, indeed. I'd say, that's the way to do it.
But, just to be 'cute', there's
COMPUTE V44 = MAX(v11,v21,v34).
Now, if a value is filled in that shouldn't be, say v34 has a value for
a class-1 respondent, Gene's code handles it about as reasonably as
possible, and mine won't.
But, hey, coding tricks are fun.
Well, SPSS itself is tricky sometimes too!
Richard made me realize that, if it is really important to know which
variable has the highest value, you can NOT use the MAX function. How does
SPSS "know" that missing values are smaller than non missings?