No License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from

2.5 | 2 ratings Rate this file 5 Downloads (last 30 days) File Size: 5.91 KB File ID: #8659 Version: 1.0
image thumbnail




06 Oct 2005 (Updated )

saves numerical matrices as ASCII data + SPSS import syntax

| Watch this File

File Information

save4spss()opens dialogue boxes to select a matrix,a cell array with variable names (optional),and specify a file name to save the matrix the SPSS syntax gets the same name.

save4spss(DATA,VARNAMES,FILE) saves the matrix DATA in the file given in FILE and creates a SPSS syntax file FILE.sps to import these data in SPSS .Variables (data columns) are named according to the elements of cell array VARNAMES.
After running save4spss, just open the generated SPSS syntax in SPSS and run it. Also see help save4spss

mystudy=[1 30 10000; 2 35 15000];
creates an ASCII file mystudy.dat and a SPSS syntax mystudy.sps.

If you run this syntax in SPSS the data are imported, the variables named and the file is saved as mystudy.sav

MATLAB release MATLAB 7.0.1 (R14SP1)
Other requirements this function was written for the German version of SPSS. If you have trouble with the decimal point/comma, play around with the import formats of SPSS and change the formatting commands that save4spss() writes in the syntax file.
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (4)
11 Nov 2016 Patrick

Just a follow up that the data will import using the GUI (type "save4spss()") however the first column is blank, everything is shifted over by one.

Comment only
06 May 2015 Martin Groen

14 Dec 2011 Casper

Casper (view profile)

Does not work for large datasets.

13 Feb 2010 Daniel Goerke

I'm wondering about this error message when executing the sav skript in SPSS:

>Fehler Nr. 105. Befehlsname: SAVE
>Dieser Befehl ist nicht gültig, bevor eine Arbeitsdatei definiert wurde.
>Dieser Befehl wird nicht ausgeführt.

in english:
>Error # 105. Command name: SAVE
>This command is not valid before a working file has been defined.
>Execution of this command stops.

I'm using PASW Statistics 18 and Matlab R2009b.
I edited the sav skript generated by save4spss() by adding the file path. The new data set created by the sav skript is empty.
Any ideas?

Best regards,

Comment only
10 Oct 2005

summary sentence incomplete

Contact us