SDahm
SDahm

Reputation: 436

SPSS sysmis is not sysmis

I've created a dataset with R and saved it with the "haven" package as .sav (SPSS file).

As i have real life data, it is filled with a lot of missings. In SPSS those missings are shown like a "." and when klicking on them they are "". This is all normal.

Now there is a strange thing happening: When i try to calculate the mean on a variable with missings, it does not work. I just get no result. Same for ANOVA.

What 's really weird is the fact that it calculates the SD for those variables. So when calculating SD sysmis = sysmis, but not for mean? As far as I know the mean is necesary for calculations of SD...

Anyway...If i first delete all missings [you don t see any difference, but press the delete button :) ], than everything works fine. Unfortunately I am to lazy for pressing more than a 100 times delete on every missing. Strg + H did not work. It says that I cannot fill in "" in numeric variables. I also tried RECODE X (sysmis=sysmis), which does not help. And I tried RECODE X (""=sysmis), which results in an error "not possible to test a numeric variable on strings".

I know you people have some suggestions. ;) Thanx in advance!

Here an example:

x1kb <- c(1:10, NA, NA, 5,6,7,8)
y1 <- rep(c(NA,777),each=8)
data1<- data.frame(x1kb, y1)

library(haven)
write_sav(as.data.frame(data1),
          paste("data1",".sav", sep=""))

Just open this file in SPSS and try to calculate descriptive stats. You'll get this: No mean but SD calculated!

Deskriptive Statistik                   
        N       Minimum Maximum mean   SD
x1kb    16      5,00    8,00           2,34521
y1      16      777,00  777,00          ,00000
Gültige Werte (Listenweise) 16

After copy paste of values in and out from Excel you get the desired result:

Deskriptive Statistik                   
        N   Minimum Maximum Mittelwert  Standardabweichung
x1kb    14  1,00    10,00   5,7857      2,63639
y1      8   777,00  777,00  777,0000    ,00000
Gültige Werte (Listenweise) 6   

Upvotes: 0

Views: 406

Answers (1)

JKP
JKP

Reputation: 5417

This account seems implausible. Perhaps the file creation was not correct. A sample of the data showing the problem along with the syntax would help.

Upvotes: 1

Related Questions