Last data update: 2014.03.03

R: Write 'mitml' objects to SPSS compatible format
write.mitmlSPSSR Documentation

Write mitml objects to SPSS compatible format

Description

Saves objects of class mitml as a text and a syntax file which can be processed by the statistical software SPSS (IBM Corp., 2013).

Usage


write.mitmlSPSS(x, filename, sep="\t", dec=".", na.value=-999, syntax=TRUE,
  locale=NULL)

Arguments

x

An object of class mitml or mitml.list (i.e., either produced by panImpute/jomoImpute or mitmlComplete).

filename

Basic file name of the data and syntax files, to be specified without file extension.

sep

The field separator.

dec

The decimal separator.

na.value

A numeric value coding the missing data in the resulting data file.

syntax

A logical flag indicating if an SPSS syntax file should be generated. This file contains instructions for SPSS for reading in the data file. Default is to TRUE.

locale

(optional) A character string specifying the localization to be used in SPSS (e.g., "en_US", "de_DE"). This argument may be specified if SPSS reads the data incorrectly due to conflicting locale settings.

Details

Multiply imputed data sets in SPSS are contained in a single file, in which an Imputation_ variable separates the original data and the various imputed data sets. During export, factors are converted to numeric, whereas character variables are left "as is".

By default, write.mitmlSPSS generates a raw text file containing the data, along with a syntax file containing instructions for SPSS. This syntax file mimics SPSS's functionality to read text files but circumvents certain problems that may occur when using the GUI. In order to read in the data, the syntax file must be opened and executed using SPSS. The syntax file may be altered manually if problems occur, for example, if the file path of the data file is not correctly represented in the syntax.

Alternatively, write.mitmlSAV may be used for exporting directly to the SPSS native .sav format. However, this may offer less control over the data format.

Value

None (invisible NULL).

Author(s)

Simon Grund

References

IBM Corp. (2013). IBM SPSS Statistics for Windows, Version 22.0. Armonk, NY: IBM Corp

See Also

panImpute, jomoImpute, mitmlComplete, write.mitmlSAV

Examples

data(studentratings)

fml <- ReadDis + SES ~ ReadAchiev + (1|ID)
imp <- panImpute(studentratings, formula=fml, n.burn=1000, n.iter=100, m=5)

# write data file and SPSS syntax
write.mitmlSPSS(imp, filename="imputation", sep="\t", dec=".", na.value=-999,
locale="en_US")

Results