|Date: ||Wed, 16 Jul 2008 10:15:23 -0700|
|Reply-To: ||"D.R. Wahlgren" <email@example.com>|
|Sender: ||"SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>|
|From: ||"D.R. Wahlgren" <firstname.lastname@example.org>|
|Subject: ||Re: SPSSX-L Digest - 14 Jul 2008 to 15 Jul 2008 (#2008-196)|
|Content-Type: ||text/plain; charset="us-ascii" ; format="flowed"|
>Date: Tue, 15 Jul 2008 09:46:56 -0400
>From: Gene Maguin <email@example.com>
>Subject: Re: Search for a value in all variables?
>>>I'd like to do two things: 1) identify the case and variable for each
>instance of a -8, and 2) create a new variable that simply flags the
>presence of at least one -8 on the case with a dichotomous (0/1)
>>>Oh, and to complicate it just a bit more, a small number of the
>variables are string.
>Task 1) Use a recode statement to create a set of corresponding indicator
>variables. Like this
>Recode x1 to x500(-8=1)(else=0) into n8_1 to n8_500.
>Recode s501 to s508('-8'=1)(else=0) into n8_501 to n8_508.
Thanks, Gene. Will this work if the string variables are
interspersed throughout the numeric variables? There aren't clean
groups of variables by type. Can I run something like this?
Recode x1 to x500(-8, '-8' =1)(else=0) into n8_1 to n8_500.
(Albert-Jan's suggestion to convert the string to numeric variables
is interesting, too, but most of my string variables have valid
string data in them, so I think the command would produce an error.)
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
For a list of commands to manage subscriptions, send the command