Re: Stacking Variables Into a New Variable

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Stacking Variables Into a New Variable

Antoon Smulders
-----Oorspronkelijk bericht-----
Van: SPSSX(r) Discussion [mailto:[hidden email]] Namens Richard
Ristow
Verzonden: vrijdag 30 juni 2006 0:13
Aan: [hidden email]
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.

-Onward,
  Richard

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?

Antoon
Reply | Threaded
Open this post in threaded view
|

Re: Stacking Variables Into a New Variable

Peck, Jon
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.

Tricky, indeed.

Regards,
Jon Peck
SPSS


-----Original Message-----
From: SPSSX(r) Discussion on behalf of Antoon Smulders
Sent: Mon 7/3/2006 3:14 AM
To: [hidden email]
Subject:      Re: [SPSSX-L] Stacking Variables Into a New Variable
 
-----Oorspronkelijk bericht-----
Van: SPSSX(r) Discussion [mailto:[hidden email]] Namens Richard
Ristow
Verzonden: vrijdag 30 juni 2006 0:13
Aan: [hidden email]
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.

-Onward,
  Richard

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?

Antoon