Monday, July 09, 2007I hate...
... debugging data analysis syntax files.
In particular, I hate the following SPSS error message, for which I can find no explanation:
>Warning # 511
>A division by zero has been attempted on the indicated command. The result
>has been set to the system-missing value.
>Command line: 58 Current case: 11444 Current splitfile group: 1
The offending code:
*Re-code for education*.
RECODE educyrs (93 thru 99=SYSMIS) (0=SYSMIS).
AGGREGATE OUTFILE = edumeans.sav
/sdedu = SD(educyrs)
I've gone to the case where the problem begins and there's data there. I've double-checked the system missing codes. I've looked at the group means, etc. I've done everything but pull my hair out.
posted by Michelle @ 6:55 PM,
- At 7/09/2007 9:10 PM, Chris Lawrence said...
Do you have any counties (countries? - whatever cnty stands for) with one data point? If you do, sd(educyrs) would be undefined (division by zero), assuming SPSS uses the sample mean formula when calculating standard deviations.
- At 7/10/2007 2:04 AM, Michelle said...
Good guess. But no, that's not it. Each cnty has at least 800+ respondents with valid responses for the educyrs variable. And the cnty that starts the error message has 1100+ cases. And no missing data coded either according to the 'variable' tab.
However, when I run crosstabs for cnty and educyrs, it doesn't report columns for all the values...it leaves out those that should be coded 'missing' even though they are not coded missing. Is there some hidden sysmis coding ????? Truly annoying.
And this is only 1 of the 15 files I had to troubleshoot. I'm down to six that have coding problems that I have to fix. :(
How's that methods paper coming along?
- At 7/10/2007 2:34 AM, Michelle said...
I give up!!!! I can get SPSS to spit out means for educyrs by cnty, but the code breaks when I switch educyrs for degree or educy_ln, which are other variations on education in the dataset. My brain is broken.
- At 7/10/2007 2:35 AM, Michelle said...
And there's code for income just above it in the syntax file that works just fine....
- At 7/10/2007 6:29 PM, Chris Lawrence said...
SPSS doesn't think the variable is nominal or ordinal by chance, does it? 99.8% of people never change the mode from "numeric", but your dataset might have been compiled by the one person in the universe who did that.
Otherwise... no clue; I try to avoid SPSS like the plague except when teaching undergrad methods.
- At 7/10/2007 6:33 PM, Chris Lawrence said...
The paper is going nowhere. The acting chair at SLU got antsy about my stuff being in my office, so I get to work on getting my crap packed and mailed off this week instead.
Hopefully Thursday I can get back to the data analysis (I'm undecided if the relatively low-error roll call scores are enough, or if I need to also do something with sophistication scores with much higher SE's) and, eventually, the poster and paper.
- At 7/10/2007 6:33 PM, Michelle said...
I thought of that at 3am and switched the offending variable to scale. It still gave me the error. When I move the code up or down in the syntax file, it runs the code and the error appears at the bottom of the syntax file after variable label commands.
I, too, hate SPSS, but figured that since my datasets were already in that format, I might as well prep the data in SPSS before switching to HLM6 for the analysis.
I've got 2 more files to troubleshoot before I'm back to this file. If I can't figure it out, could I enlist your services in exchange for dinner or a few beers in PA? (I know you have other work to do...)
- At 7/12/2007 1:04 AM, Chris Lawrence said...
I may take you up on that. However, I should warn you in advance that my likely solution is to read the data into R and have it calculate the aggregated statistics, then write it back out into an SPSS file, largely because the only copy of SPSS I have access to is on the computer (a term I use loosely to describe the heap of Dell junk provided for my use by SLU) in my soon-to-be-vacated office.
So if you can code that up in R or Stata without me, you may save on food or a few beers :)