In these post you will be able to find: syntax example, a short data base to repeat the example, and a video tutorial which shows how to export a data base from spss to mplus, the written notes made in the video, the MPLUS syntax produced, the dataset for mplus, and the mplus ouput results.
MPLUS, is not able yet to read database in every format, like *.sav files from SPSS, *.dta files from STATA or *.sd7 files from SAS. It handles csv files and tab files [see the links examples], which are mainly text database formats, which are called in general ASCII (text) files. The first one express the different columns between the values using a "," for each column, and a different line for each row on the text file. The second, instead of a character use a 'tab' separation in the text. These are the most standard and simple database format.
Usually, data in SPSS from cross sectional or panel studies can have a lot of variables, specially from long survey data collections. The original database from DIPUC study that we're going to use has 2122 data fields. Although, for the example we're going to use just a short form of it, with only one hundred data fields [aprox.]. To cope with the huge amount of variables one option is to use a syntax in SPSS to select the variables we need for the analysis and create a short database more easy to handle. Another reason to do this, is the limit of MPLUS to handle variables, which is 500 datafields. Although these are plenty data fields, could be not enough to try to handle a whole database from a survey directly, like the one mention above [see the image in the paragraph, is a screenshot of the original database in 10% view, in excel format].
The recommend syntax is the following:
SAVE TRANSLATE OUTFILE='C:\data\[put the name the database here].txt'/TYPE=TAB/MAP/REPLACE/CELLS=VALUES/TEXTOPTIONS DECIMAL= DOT/KEEP=variable01variable02variable03variable04variable05variable06 .
You can specify the name of the database you want to save and the location, in the first line, after the command 'SAVE TRANSLATE OUTFILE=' . After the KEEP= line, you can also specify the in which order you want the variables to be presented by calling them.
Another recommended option (Geiser, 2009) is to recode the missing values from SPSS to an unmistakeable value, like 999, -99, or other. This could be done, using the following syntax:
RECODE variable01 variable02 variable03 variable04 (SYSMIS=-99) .
In general, the syntax needed is to RECODE first, then SAVE TRANSLATE to an ASCII file.
Once data is recoded, and exported, could be read in MPLUS, to make a simple descriptives of the data, using this general syntax:
title: Checking if data is well exported and readable by MPLUS;data: file = C:\EXAMPLE01.txt;! This is a comment line! This is yet another ...variable: names =var01var02var03var04var05var06var07var08;missing = all (-99);analysis: type = basic;References
Geiser, C. (2009). Datenanalyse mit Mplus: Eine anwendungsorientierte Einführung. VS Verlag für Sozialw.
0 comments:
Post a Comment