Date: Thu, 9 Sep 2010 01:16:59 -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: How to get zeros away
For what it's worth,
I would go with the KISS approach and do:
missing values IMP1 to SAT101 (0).
Now, your code isn't "working" for the following reason;
It first checks to see if the variable is equal to 0.
If it is the value is set to the result of evaluating
the logical expression "#Y=missing(#Y)" resulting in either 0 or 1 (0 if
FALSE, 1 if TRUE). Of course #Y isn't missing, it equals 0!!!
Since Y isn't missing it returns FALSE (i.e 0).
If you were to run that same code checking for 1 for instance it would
change all the 1's to 0's
> do repeat #Y = IMP1 to SAT101.
> if #Y = 0 #Y = missing(#Y).
> end repeat.
> exe.
A few comments, variables with a # prefix are referred to as scratch
variables. You should probably stick with regular variables unless you
understand their properties (DO REPEAT might very well be tolerant of this,
but I have neither the time nor inclination to test it at the moment.
You should also get rid of that hideous EXE.
And as Bruce eloquently posits in his sig:
>"When all else fails, RTFM."
HTH, David
-As soon as I hit post I'm going to receive about 20 OUT OF THE OFFICE
replies from people who don't bother to sign off the list when they go on
vacation! Does anybody know how to filter that CRAP? -GMail...
On Wed, 8 Sep 2010 15:01:10 -0700, Bruce Weaver <bruce.weaver@hotmail.com>
wrote:
>Another variation on Gene's second method would be to simply define 0 as a
>missing value.
>
>missing values IMP1 to SAT101 (0).
>
>This way there's nothing to recover. If you decide you no longer want to
>treat 0 as missing, just issue another missing values command like this:
>
>missing values IMP1 to SAT101 ().
>
>
>
>Gene Maguin wrote:
>>
>> Yang,
>>
>> Here is two ways to do this but also read up in the syntax references on
>> the
>> commands used because you'll have to do things like this again and again.
>>
>> * change 0 to sysmis.
>> do repeat #Y = IMP1 to SAT101.
>> if #Y = 0 #Y = $sysmis.
>> end repeat.
>> exe.
>>
>> * change 0 to user missing value (assume to 9).
>> do repeat #Y = IMP1 to SAT101.
>> if #Y = 0 #Y = 9.
>> end repeat.
>> exe.
>> Missing values IMP1 to SAT101(9).
>>
>> A user missing value value gives you greater flexibility should you ever
>> need to recover the true values.
>>
>> Gene Maguin
>>
>>
>> -----Original Message-----
>> From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of
>> Ilybbb
>> Sent: Wednesday, September 08, 2010 2:13 PM
>> To: SPSSX-L@LISTSERV.UGA.EDU
>> Subject: How to get zeros away
>>
>> Hello,
>>
>> First time being here...
>> Doing a survey analysis and would like to use SPSS to take all the zeros
>> away first. Belwo is the SPSS part but it doesn't work. Any comments would
>> be greatly helpful.
>> Thanks!
>>
>> do repeat #Y = IMP1 to SAT101.
>> if #Y = 0 #Y = missing(#Y).
>> end repeat.
>> exe.
>>
>> * IMP1 to SAT101 are Numeric type.
>>
>> =====================
>> 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
>>
>>
>
>
>-----
>--
>Bruce Weaver
>bweaver@lakeheadu.ca
>http://sites.google.com/a/lakeheadu.ca/bweaver/
>
>"When all else fails, RTFM."
>
>NOTE: My Hotmail account is not monitored regularly.
>To send me an e-mail, please use the address shown above.
>
>--
>View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/How-to-get-zeros-away-tp2815915p2822398.html
>Sent from the SPSSX Discussion mailing list archive at Nabble.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
|