Replace -1 values by 0

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

Replace -1 values by 0

spssdummy
I would like to replace all -1 values with a 0 in my dataset. Now I found out
how to do it, but I need to use syntax for my project so that other people
working on this project in the future can re-do this.
Any suggestions?



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (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
Reply | Threaded
Open this post in threaded view
|

Re: Replace -1 values by 0

bdates

Mischa,

recode your_variablelist (-1=0) .
execute .

Two things. Directions for this are in the Command Syntax Reference under Help at the end of your navigation bar at the top. I think you need to spend some time with this reference. This listserv is principally for problems that the requester has already spent a fair amount of time trying to solve on their own.

Second, you should do this on a copy of your dataset. Never change your original dataset because you will need the original format at some time. So copy the dataset first and then use that copy. Here's the whole thing.


dataset name youroriginaldatasetname .
dataset copy yourworkingdatasetname .
dataset activate yourworkingdatasetname .
recode your_variablelist (-1=0) .
execute .


Brian

From: SPSSX(r) Discussion <[hidden email]> on behalf of spssdummy <[hidden email]>
Sent: Monday, May 13, 2019 10:59:24 AM
To: [hidden email]
Subject: Replace -1 values by 0
 
I would like to replace all -1 values with a 0 in my dataset. Now I found out
how to do it, but I need to use syntax for my project so that other people
working on this project in the future can re-do this.
Any suggestions?



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (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 [hidden email] (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
Reply | Threaded
Open this post in threaded view
|

Re: Replace -1 values by 0

Art Kendall
In reply to this post by spssdummy
Are the -1 missing values?
Do you intend to use them a zeros in calculations?

I have seen situations where this kind of recode has not had a good
rationale.

However, something like this will work.

recode MyVar1 to MyVar10 (-1=0) (else=copy) into MyNewVar1 to MyNewVar10.

If zero has no other intrinsic meaning and if you still need those values
treated as missing

you would need something like this.
Missing values MyNewVar1 to My NewVar10 (0).







-----
Art Kendall
Social Research Consultants
--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (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
Art Kendall
Social Research Consultants