I used the write.foreign command from the foreign library to import R data to SPSS, I have used the following code but fail:
write.foreign(esoph,"esoph.dat","esoph.sps",package="SPSS")
But when I try to run the esoph.sps file in SPSS, the output gives me the following message is SPSS output:
DATA LIST FILE= "esoph.dat" free (",")
/ agegp alcgp tobgp ncases ncontrls .
>Error # 31 in column 17. Text: esoph.dat
>File not found.
>This command not executed.
VARIABLE LABELS
Can anyone tell me what happen? Thanks.
list.files(pattern = "esoph")give if you run it immediately after thewrite.foreigncall? If the files are in the working directory, is SPSS looking for the files in the correct directory. The error suggests it couldn't find your files, so start with making sure you know where SPSS is looking for them, and that they are in that place. - Gavin Simpson