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

Description Usage Arguments Details Value Note See Also Examples

View source: R/spss_export.R

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

1
2
3
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.

Details

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

Value

No value is returned.

Note

If neither SPSS nor PSPP is 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

1
2
3
4
5
6
7
8
9
## 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)

ImportExport documentation built on Jan. 13, 2021, 7:39 a.m.