Learn R Programming

ImportExport (version 1.3)

spss_export: Export data to SPSS (.sav) by using runsyntx.exe or pspp.exe

Description

Export data to txt and syntax to an spss syntax file and then runs runsyntx.exe (located in the SPSS folder) in order to create the final file with .sav extension containing the data frame we wanted to export. Date variables in the original data frame are also identified when reading the .sav file with SPSS.

Usage

spss_export(table,file.dict=NULL,file.save=NULL,var.keep="ALL",
file.runsyntax="C:/Archivos de programa/SPSS/runsyntx.exe",
file.data=NULL,run.spss=TRUE,dec=".")

Arguments

table

A data frame to be exported. If it's a matrix, it will be converted into data frame.

file.dict

Spss syntax file containing the variable and value labels.

file.save

The name of the .sav file we want to create.

var.keep

Name of the variables to save. All variables will be saved by default.

file.runsyntax

The path to the file runsyntx.exe or pspp.exe .

file.data

The name of the .txt file containing the data. It will be created as a temp file by default.

run.spss

If true, it runs SPSS and creates the .sav file, else it shows the syntax on the screen.

dec

The string to use for decimal points, it must be a single character.

Value

No value is returned.

Details

Both runsyntax.exe (from SPSS) and pspp.exe works the same way.

See Also

spss_import,var_view

Examples

Run this code
# NOT RUN {
table=mydata
file.dict=NULL
file.save="C:\xxx.sav"
var.keep="ALL"
export.SPSS(table=table,file.dict=file.dict,var.keep=var.keep,file.save=file.save)

# }

Run the code above in your browser using DataLab