4

I have a .sav (SPSS) data file. The file is password protected, and I have the password. I do not have SPSS.

I typically use the haven package (read_sav()) to import .sav files into R; however, I cannot find a reference for how to unlock the file with the password.

No mention of "password" exists in the haven manual, so I suspect I will need either another package or script to supplement.

Can haven unlock data with passwords (if so how)? Is there another option to access the .sav data and provide the same data format as haven::read_sav():

A tibble, data frame variant with nice defaults. Variable labels are stored in the "label" attribute of each variable.

The format is important because I have existing scripts that assume the format of the data matches the labelled-variables format from haven::read_sav().

AWaddington
  • 725
  • 8
  • 18
  • 4
    The function `read.sav` of the `readspss` package (https://github.com/JanMarvin/readspss ) has a `pass` option. From the help: If encrypted sav should be imported, this is a maximum of ten character encryption key). – Marco Sandri Sep 30 '22 at 19:22
  • 1
    @MarcoSandri This opens the file (thx). The variables are in a different format than ``haven`` but I should be able to work around that. I thought about using ``readspss::read.sav`` to unlock the file, ``readspss::write.sav`` to save an unlocked copy, then ``haven::read_sav``for formatting to avoid rewriting analysis scripts, but ``readspss::write.sav`` throws an error "label and ncols differ. each col needs a label". I'm not sure if that's a problem with the original file or format of the imported data after ``read.sav``. I'll post back if I figure it out. – AWaddington Sep 30 '22 at 20:40

0 Answers0