Hi SPSS Listserve:
I'm trying to add 23 variables I have created and coded as Var1: Yes=1 No=0 Else= system missing Var 2: Yes=1 No=0 Else=system missing etc...and when I add these 23 variables together I am getting missing values. e.g. 1+0+0+"."+1+0 = "." instead of getting a value of 2. I'm not sure what I'm doing wrong, but it's clear I'm doing something wrong. Any advice would be greatly appreciated. Thanks! /Angela Doctoral Student Tulane University School of Public Health & Tropical Medicine [hidden email] Living on Earth is expensive, but it does include a free trip around the sun. _________________________________________________________________ Share your special moments by uploading 500 photos per month to Windows Live Spaces http://clk.atdmt.com/MSN/go/msnnkwsp0100000001msn/direct/01/?href=http://spaces.live.com/signup.aspx |
If you use the SUM function, it will sum only the valid values, ignoring the
missing values. By default, it will give a sum as long as there is at least one non-missing value. There is an option (which I've never actually used) to specify a number of valid values other than one required for a non-missing result. David Wasserman Custom Data Analysis and SPSS Programming ----- Original Message ----- From: "angela shen" <[hidden email]> To: <[hidden email]> Sent: Sunday, October 01, 2006 9:39 AM Subject: Adding with missing values Hi SPSS Listserve: I'm trying to add 23 variables I have created and coded as Var1: Yes=1 No=0 Else= system missing Var 2: Yes=1 No=0 Else=system missing etc...and when I add these 23 variables together I am getting missing values. e.g. 1+0+0+"."+1+0 = "." instead of getting a value of 2. I'm not sure what I'm doing wrong, but it's clear I'm doing something wrong. Any advice would be greatly appreciated. Thanks! /Angela Doctoral Student Tulane University School of Public Health & Tropical Medicine [hidden email] Living on Earth is expensive, but it does include a free trip around the sun. _________________________________________________________________ Share your special moments by uploading 500 photos per month to Windows Live Spaces http://clk.atdmt.com/MSN/go/msnnkwsp0100000001msn/direct/01/?href=http://spaces.live.com/signup.aspx |
In reply to this post by angela shen
Angela,
If you simply want to count the number of "1"s in the list of variables for each case then use the COUNT command (Transform>Count...) and specify the value you are interested in, in this case "1". If the variables are consecutive you can use the keyword TO, as in VAR1 TO VAR23, when you write the syntax. You can also use the SUM function with the COMPUTE command, but I think COUNT is more convenient. Dominic Lusinchi Statistician Far West Research Statistical Consulting San Francisco, California 415-664-3032 www.farwestresearch.com -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of angela shen Sent: Sunday, October 01, 2006 8:39 AM To: [hidden email] Subject: Adding with missing values Hi SPSS Listserve: I'm trying to add 23 variables I have created and coded as Var1: Yes=1 No=0 Else= system missing Var 2: Yes=1 No=0 Else=system missing etc...and when I add these 23 variables together I am getting missing values. e.g. 1+0+0+"."+1+0 = "." instead of getting a value of 2. I'm not sure what I'm doing wrong, but it's clear I'm doing something wrong. Any advice would be greatly appreciated. Thanks! /Angela Doctoral Student Tulane University School of Public Health & Tropical Medicine [hidden email] Living on Earth is expensive, but it does include a free trip around the sun. _________________________________________________________________ Share your special moments by uploading 500 photos per month to Windows Live Spaces http://clk.atdmt.com/MSN/go/msnnkwsp0100000001msn/direct/01/?href=http://spa ces.live.com/signup.aspx |
In reply to this post by angela shen
If you are using a simple COMPUTE command:
COMPUTE Sumvar=Var1+Var2+Var3... Then, if any variable is missing, the result is set to system-missing. As others have suggested, use either the SUM function in your COMPUTE command or use the COUNT command. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of angela shen Sent: Sunday, October 01, 2006 10:39 AM To: [hidden email] Subject: Adding with missing values Hi SPSS Listserve: I'm trying to add 23 variables I have created and coded as Var1: Yes=1 No=0 Else= system missing Var 2: Yes=1 No=0 Else=system missing etc...and when I add these 23 variables together I am getting missing values. e.g. 1+0+0+"."+1+0 = "." instead of getting a value of 2. I'm not sure what I'm doing wrong, but it's clear I'm doing something wrong. Any advice would be greatly appreciated. Thanks! /Angela Doctoral Student Tulane University School of Public Health & Tropical Medicine [hidden email] Living on Earth is expensive, but it does include a free trip around the sun. _________________________________________________________________ Share your special moments by uploading 500 photos per month to Windows Live Spaces http://clk.atdmt.com/MSN/go/msnnkwsp0100000001msn/direct/01/?href=http://spaces.live.com/signup.aspx |
In reply to this post by angela shen
And if you want the sum of all non-missing values you can use:
sum.1(variable list) [the .1 indicates that at least 1 value must be non-missing] -----Original Message----- From: Beadle, ViAnn [mailto:[hidden email]] Sent: Monday, October 02, 2006 6:03 AM To: [hidden email] Subject: Re: Adding with missing values If you are using a simple COMPUTE command: COMPUTE Sumvar=Var1+Var2+Var3... Then, if any variable is missing, the result is set to system-missing. As others have suggested, use either the SUM function in your COMPUTE command or use the COUNT command. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of angela shen Sent: Sunday, October 01, 2006 10:39 AM To: [hidden email] Subject: Adding with missing values Hi SPSS Listserve: I'm trying to add 23 variables I have created and coded as Var1: Yes=1 No=0 Else= system missing Var 2: Yes=1 No=0 Else=system missing etc...and when I add these 23 variables together I am getting missing values. e.g. 1+0+0+"."+1+0 = "." instead of getting a value of 2. I'm not sure what I'm doing wrong, but it's clear I'm doing something wrong. Any advice would be greatly appreciated. Thanks! /Angela Doctoral Student Tulane University School of Public Health & Tropical Medicine [hidden email] Living on Earth is expensive, but it does include a free trip around the sun. _________________________________________________________________ Share your special moments by uploading 500 photos per month to Windows Live Spaces http://clk.atdmt.com/MSN/go/msnnkwsp0100000001msn/direct/01/?href=http://spa ces.live.com/signup.aspx |
Free forum by Nabble | Edit this page |