Skip to content

Improved SPSS .sav to flat or long csv conversion tool.

License

Notifications You must be signed in to change notification settings

erbarratt/sav2csv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sav2csv

SPSS .sav to short or long format csv file

Compile using CMake / make

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 + maths.h.

# sudo curl -OL https://github.com/erbarratt/sav2csv/archive/refs/heads/main.tar.gz

or

# sudo wget https://github.com/erbarratt/sav2csv/archive/refs/heads/main.tar.gz

Verify installation using the version option:

# ./sav2csv -v

Should output similar to:

sav2csv version 1.9.3 2021-04-02

Usage

To call the program in it's current directory, use:

# sudo ./sav2csv [options] [arguments]

sudo is needed for being able to write files correctly.

Help

The help option is exclusive - the help output will only run if -h is the sole option passed. Help lists all available options.

# ./sav2csv -h

Version

The version option is exclusive - the version output will only run if -v is the sole option passed.

# ./sav2csv -v

Input file*

Use -f to define the input .sav file.

*This option is required

# sudo ./sav2csv -f filename.sav

Output file prefix

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 ./sav2csv  -f filename.sav -o prefix

Output directory

Use -w to define the directory for any output csv's. Defaults to "" (current directory).

# sudo ./sav2csv  -f filename.sav -w /path/to/your/directory/

CSV Line limit

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 ./sav2csv  -f filename.sav -l 500000

Silent mode

Use -s to disable all output to stdout.

# sudo ./sav2csv  -f filename.sav -s

Debug mode

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 ./sav2csv  -f filename.sav -d

Flat csv

Use -F to output csv files as flat table style. Default is long format csv (many to many).

# sudo ./sav2csv  -f filename.sav -F

Row index

Use -R to output the row index as the first field in each line of the csv.

# sudo ./sav2csv  -f filename.sav -R

Full example

Set filename, output prefix and line limit, in silent mode, as a flat style csv including row indexes.

# sudo ./sav2csv  -f filename.sav -o prefix -l 5000000 -sFR

About

Improved SPSS .sav to flat or long csv conversion tool.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages