R: Export data to .sav by using SPSS(runsyntx.exe)

spss_export | R Documentation

## Export data to .sav by using SPSS(runsyntx.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.
`table.dict` | The name of the spss syntax file (.sps) we want to create.
`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.
`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.

### Note

If SPSS is not installed the function can just return the data in a .txt file and the syntax in an SPSS syntax file (.sps).

### See Also

`spss_import`,`var_view`

### Examples

    ##  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)
    ## End(Not run)