|
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 [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 |
|
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:[hidden email]] On Behalf Of Ilybbb Sent: Wednesday, September 08, 2010 2:13 PM To: [hidden email] 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 [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 |
|
Administrator
|
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 ().
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
|
Administrator
|
In reply to this post by Ilybbb
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 <[hidden email]> 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:[hidden email]] On Behalf Of >> Ilybbb >> Sent: Wednesday, September 08, 2010 2:13 PM >> To: [hidden email] >> 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 >> [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 >> >> > > >----- >-- >Bruce Weaver >[hidden email] >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: >Sent from the SPSSX Discussion mailing list archive at 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
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
|
In reply to this post by Ilybbb
the best way is to assign zero as a user missing value.
missing values imp1 to sat101 (0). add value labels imp1 to sat101 0 'whatever kind of missing zero means'. It is inadvisable to recode them to sysmis. By reserving sysmis to situations where the system assigns the value to missing because it cannot do what you are telling it to do, you greatly facilitates debugging your syntax. "System missing" means the the system had to assign a missing value. "User missing" means that the user has a reason for this value being missing, things like not applicable, refused to answer, legitimate skip, cannot read, etc. It is important to know whether values are missing at random, are not applicable (i.e., not in a subpop), etc. Art Kendall Social Research Consultants On 9/8/2010 2:12 PM, Ilybbb wrote: > 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 > [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
Art Kendall
Social Research Consultants |
|
Administrator
|
In reply to this post by David Marso
I must give credit to my late father for that one--it's my variation on his "When all else fails, read the directions/instructions". Apparently he didn't know about the "fine manual". ;-) This is one of the reasons post to this list via Nabble (http://spssx-discussion.1045642.n5.nabble.com/) using a hotmail address rather than my everyday e-mail. I still get the OUT OF OFFICE replies, but they're sitting in the hotmail inbox, which I look at only very occasionally, and then it's usually just to delete everything. Cheers, Bruce
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
| Free forum by Nabble | Edit this page |
