SPSS .sav to short or long format csv file
PLEASE USE NEW REPOSITORY SAV2CSV - THIS ONE IS NO LONGER MAINTAINED https://github.com/erbarratt/sav2csv
Installation has so far been tested on Debian (+Raspbian, +Ubuntu 20.04), Redhat (+CentOs 7) and macOS Catalina (10.15.7).
Only requires C Standard Library.
# sudo curl -OL https://github.com/erbarratt/savtocsv/archive/refs/heads/main.tar.gz
or
# sudo wget https://github.com/erbarratt/savtocsv/archive/refs/heads/main.tar.gz
Verify installation using the version option:
# ./savtocsv -v
Should output similar to:
savtocsv version 1.9.3 2021-04-02
To call the program in it's current directory, use:
# sudo ./savtocsv [options] [arguments]
sudo is needed for being able to write files correctly.
The help option is exclusive - the help output will only run if -h is the sole option passed. Help lists all available options.
# ./savtocsv -h
The version option is exclusive - the version output will only run if -v is the sole option passed.
# ./savtocsv -v
Use -f to define the input .sav file.
*This option is required
# sudo ./savtocsv -f filename.sav
Use -o to define the prefix for any output csv's. The program will append x.csv, where x is the number of the current csv file being written to, determined by the line limit option. Defaults to "out" (therefor out1.csv, out2.csv...).
# sudo ./savtocsv -f filename.sav -o prefix
Use -l to define how many rows should make up each output csv. Defaults to 1000000 (1 million). If output rows less, then only one file is generated. Program will check to see if this is a valid integer greater than 0.
# sudo ./savtocsv -f filename.sav -l 500000
Use -s to disable all output to stdout.
# sudo ./savtocsv -f filename.sav -s
Use -d to enable Debug mode, which will output all information read by the program from the .sav file. Debug mode will only output if not in silent mode.
# sudo ./savtocsv -f filename.sav -d
Use -F to output csv files as flat table style. Default is long format csv (many to many).
# sudo ./savtocsv -f filename.sav -F
Use -R to output the row index as the first field in each line of the csv.
# sudo ./savtocsv -f filename.sav -R
Set filename, output prefix and line limit, in silent mode, as a flat style csv including row indexes.
# sudo ./savtocsv -f filename.sav -o prefix -l 5000000 -sFR