[R] SPSSyntax function

Adrian Dusa dusa.adrian at gmail.com
Wed Nov 26 21:24:47 CET 2008


Dear all,

I've created a function called "spssyntax" that creates a syntax for
variable labels and value labels in SPSS (in the *sps* syntax format
that was recently discussed), using a list of such labels in R.
The entry list looks like this (between the ### signs):

###
labels <- list()

labels$varlab$id <- "ID"
labels$varlab$v1 <- "A label for the first variable"

labels$vallab$v1 <- c(
"Very low"=1,
"Low"=2,
"Middle"=3,
"High"=4,
"Very high"=5,
"Not Applicable"=-1,
"Not Answered"=-2)
###


And the result syntax file looks like this (again, between the ### signs):

###
VARIABLE LABELS
id "ID"
v1 "A label for the first variable"
.

VALUE LABELS
v1
1 "Very low"
2 "Low"
3 "Middle"
4 "High"
5 "Very high"
-1 "Not Applicable"
-2 "Not Answered"
/
.

MISSING VALUES
v1 (-1, -2)
.
###

Should there be any package interested in adopting this function
(maybe foreign?), I'd be happy to contribute it.
Best regards,
Adrian



More information about the R-help mailing list