Skip to content
Back to formatted view

Raw Message

Message-ID: <4CFE1557.1020900@bitwrit.com.au>
Date: 2010-12-07T11:07:03Z
From: Jim Lemon
Subject: Please help with write.foreign(SPSS)
In-Reply-To: <AANLkTimw7MPAoCGRFJa1QiPMK_9r0nesN5iUJQ3m=wqF@mail.gmail.com>

On 12/07/2010 09:42 PM, He wrote:
> Hi Jim,
>
> Thank you so much for your suggestion. I have tried ".csv" and ".sav".
> ".sav"  works better. I learned "DAT file" from the internet. There
> were some similar discussion about wirte.foreign() before.
>
> I don't really know how the transfermation of the files between R and
> SPSS works. When i got several files, I was a little lost.
>
> But I should emphasize my main problem which is the character variable
> is not read shown up in the file. I mean i want to see e.g., 000CF7CC
> in the data instead of its corresponding value 1 defined by SPSS
> automatically. Another problem is how to keep the variable names in
> the "data file".
>

Normally, when you write out a data file in SPSS format from R, it 
should correspond to an SPSS "system" or .SAV file. I would expect to 
see something like this:

library(foreign)
write.spss(df,file="k:/res.sav")

Then in your SPSS file:

GET /FILE="k:\res.sav".

I don't think the .SAV extension is necessary, but I'm not sure.

Jim