How to recover lost SPSS syntax4/15/2015 By now, you should know how important it is to save your syntax in SPSS. Well, despite your best efforts, sometimes accidents happen. The last couple of summers, I did data management for a longitudinal study of college students’ sexual behaviors. Once, after I hit a flow state and didn’t look up from my computer for hours, my stomach’s aggressive growling jerked me back to reality. Adhering to my policy never to work when hungry, I decided to close my SPSS file and have some lunch. But when SPSS prompted me to save my syntax, my hypoglycemic brain directed my fingers to click “don’t save.” I noticed what I was doing a split second before I clicked the wrong button, but it was already too late! My last four hours of work were gone. Or were they? (They weren’t.) Here is what I did to recover my syntax: Step 1. Don’t Panic. Step 2. Eat lunch. Nothing helps me keep my cool like having some PB&J in my belly. Step 3. Calmly Google how to recover SPSS syntax. My Google wizardry taught me that, fortunately, the syntax window is not the only place SPSS stores your syntax. The SPSS journal logs your activity on SPSS and stores it in one file. That means every time you open or close a window or perform a command, it goes in the journal. You can change the journal settings to record only your recent activity, but the default is to record everything you ever do in one giant file. To access the journal file, go to Edit --> Options…, and select the File Locations tab. This window will show you the location of the journal file. To open the journal file, you have two options. First, you can open it in SPSS by opening the journal file as if it were a syntax file. Second, you can open the journal file as a text file. After closing SPSS, navigate to the location listed for the journal file, and open it with a text editor like Notepad. This video gives a good demonstration of how to use a journal file, beginning around 3:00. It’s that easy to find lost syntax. However, just because the journal file exists doesn’t mean you shouldn’t be meticulous about saving your work in syntax files. What if you find that your journal was mysteriously set to “overwrite” instead of “append”? Syntax files also offer features that the journal doesn’t, like the ability to store commands in multiple files. But if you forget to eat lunch and make a mistake because you are working while hungry, the journal is a very handy backup. Just remember to take food breaks next time. 6/16/2015 03:45:15 am this just helped me so much - thank you! 7/26/2015 01:20:05 pm This... saved me. 11 PM, 6 hours of work on a project worth 20% of my grade, and most of the complicated work done after the last save. And SPSS freezes during the save, and the syntax doesn't save, but the data set does. And this post honestly kept me from killing someone with my bare hands, because it meant I could go in, copy and past from the last point saved in the master file, and take out the tests I knew were my goofs. 10/12/2015 05:19:31 am You are the best, thank you very much for sharing this knowledge with the world!!! 12/11/2015 08:09:28 am Thanks a lot for your help! 2/27/2016 08:06:23 am Saved my life man! 4/9/2016 11:57:36 am I was able to locate the journal file, but I am unable to open it as a syntax file through SPSS. I can open it in word, but it just lists all the test that I ran (the data is not actually there). When I try to open it in SPSS, the file is empty? Help! 7/11/2016 03:12:30 am Hi Mallory. I'd like to know if you have gotten a solution to the above mentioned problem. I'm in the same situation at the moment and I need help asap. 1/20/2017 10:12:36 am THANK YOU!!! 3/19/2017 11:32:04 am Hi guys/gals, I'm having a big trouble of recovering the job I've done in my project, unfortunately at least 50% of the job I've done for 2 days has gone.. yeah I know it's kinda stupid I didn't save it, but it happened cause I thought it has some kind of autosave!! Anyway my trouble is that when I'm trying to paste stuff from JNL file I'm getting a lot of errors!! if anyone could help me, that would be a lifesaving.Thanks 4/19/2018 08:52:52 am @Armend If you have trouble opening the .jnl file in SPSS as a syntax file, copy it and paste it to another location. In this copy, remove the .jnl from the file name and change it into .sps, then you should be able to open it in SPSS, as SPSS recognizes it as a syntax file. 11/16/2017 08:58:26 pm What a lifesaver! I was mid-breakdown after losing a day's worth of agonizing work thanks to a careless close of the syntax file. Luckily my partner had the good sense to use the magic of Google, which led us to your blog. I'm saved by the journal file! 1/7/2018 06:59:57 pm When i saw the cartoon virus-look alike thing i was like 'this is NOT funny & thats an irritating picture and too many words before i reach the line that tells me how to retrieved my info because my paper is due in the next few hours and SPSS abruptly closed!!!' Then i read your instructions and now an thinking 'THIS IS THE BEST UPLOAD EVER! And that cartoon thing is funny! Haha' :) Thanks!! You are a life saver. 2/1/2018 08:54:41 am Rose, I love you. Your post has saved me maybe an hour or two of syntax work, but days of logic that I mentally let go the second I created my syntax...and then lost when I closed my window. 2/14/2018 09:31:33 pm THANK YOU!!!!!!! 3/26/2018 09:39:22 am I work in Digital Preservation and have been asked to recover data from an SPSS file created in the late 70's. The file has been extracted from a 9 track tape and after removing the header, SPSS does not seem to recognize this as a .sav file and begins a text import. any ideas ? 4/19/2018 08:52:29 am YES got it back! Thanks a lot ^_^ 4/25/2018 07:14:09 pm Helpful. 6/27/2018 08:44:28 am Lifesaver 7/28/2018 02:29:00 pm You are a lifesaver! Thank you!!! 8/21/2018 01:39:31 am Thank you so much! Complete lifesaver!! 8/22/2018 08:11:11 am Yes the file is found and is opened in notepad. How can I open it in spss again to find my data? 9/24/2018 09:33:23 pm Oh my god, this blog saved my project) I've counted a lot of dichotomous 'if-then' variables, and thought they were all gone! XXX 11/14/2018 06:36:50 am thank you alice, you have saved me 2 days work 11/22/2018 12:12:12 am i am still not able to get my file opened 12/20/2018 05:51:17 am Rose, Thank You! I can't tell you how much work this saved me!!!! 3/6/2019 08:15:59 pm A lot of the data i had entered aren't present in the file. Seems i didnt save it afterwards. 5/5/2019 01:05:36 pm Thank you!!! 5/7/2019 07:48:06 am Hi, 5/24/2019 08:17:35 am The video doesn’t open.. anyone who can help? 8/19/2019 08:31:43 am ty 9/3/2019 02:48:21 am please guys i need your help, my device was attacked by ransomeware virus and i need help recovering my spss file. 10/17/2019 03:11:10 am God bless you. You're a life saver. 11/27/2019 12:49:23 pm Hey, 11/28/2019 08:10:56 am *Update**** 4/24/2020 06:06:47 am Five years later and this is still helping people! Thank you so much! Was able to recover exactly what I needed. 8/3/2020 02:14:05 pm Hi Rose, you have no idea what you have done. Thank you so so very much. This post was veeery helpful to me. 9/19/2020 04:37:48 pm Can i get back my input file of spss i lost it 12/2/2020 12:31:00 am Saved my life. 3AM. I was not trying to redo all of my work again. Thank you! Leave a Reply. |
To open the journal file, you have two options. First, you can open it in SPSS by opening the journal file as if it were a syntax file. Second, you can open the journal file as a text file. After closing SPSS, navigate to the location listed for the journal file, and open it with a text editor like Notepad. A cross-platform Python interface to the IBM SPSS Statistics Input Output Module. Read or Write SPSS system files (.sav,.zsav). Works with Python 2.7, 3.3, 3.4, 3.5, pypy. Installation: python setup.py install. Or alternatively: pip install savReaderWriter. To get the ‘bleeding edge’ version straight from the repository do. I have.sav file and i need to convert it into csv file. I tried to use import savReaderWriter library but its not working. I am getting this error: SPSSIOError: Problem opening file b'C: Users I know in R it might be easier but i really need in Python. As others have mentioned above, SPSS is a software package, and these SAV files are for use by the SPSS program. Asking you to open them without the software they are designed to be used with is like asking you to 'open' an SQL Server database file without installing SQL server. How to open SAV files You need a suitable software like Saved File to open a SAV file. Without proper software you will receive a Windows message 'How do you want to open this file?' (Windows 10) or 'Windows cannot open this file' (Windows 7) or a similar Mac/iPhone/Android alert. If you cannot open your SAV file correctly, try to right-click.
SPSS data sets
If you have read data from a different format than SPSS, or if you have modified an existing SPSS file, you may wish to save your file for further use in SPSS format. This is done with the SAVE FILE
command.
Example:
SAVE OUTFILE = 'd:mydirectorymysubdirectorymydata.sav'.
where you have to fill in your directory and data set names. Note that SPSS issues no warning if you overwrite an existing data set, thus be careful in the choice of the name of this data set. Of course, if you have modified an existing data set, using the old name may be exactly what you want. However, this should only be done if you have augmented your data set, i.e. if you have added new variables. If you have changed, or even deleted, old variables, as a beginner you should use a different name for your data set even if you have changed or deleted these variables precisely because you wanted to get rid of them. But perhaps you have committed a mistake and wish to redo your modifications in a different way; this will be impossible if the original variables have not been kept somewhere.
As with the GET FILE
command, the KEEP, DROP
and RENAME
subcommands are available to change your data file during the SAVING process. If you want to get rid of most of your variables, it is useful to indicate which variables you want to KEEP; if you want to keep most of the variables, you will prefer to indicate which variables to DROP. Renaming variables can be useful for various purposes. Here's an example:
SAVE OUT = 'd:mydirectorymysubdirectorymydata.sav' | |
/ DROP var11 var15 var17 var88 | |
/ RENAME (var10 var19 = gender age). |
Note that SAVing your data file does not affect your working file. Thus, if you wish to use the SAVed data set for your next analysis steps, you first have to read in the file anew with the GET FILE
command. This may happen more frequently than you think; for instance, you may have modified your data, and in the process a number of 'intermediate' variables may have been used which are not of interest by themselves, but were needed in one way or other for creating new variables of interest. (For instance, you may wish to compute the overall household income from different types of income of several persons in a household; this may easily amount to hundred variables or more.) But when you have finished your task, these variables are no longer useful and only render your data set unnecessarily large. This is the moment when it is a good choice to SAVe your data and DROP
those variables you don't need any longer (or to KEEP
those with which you wish to pursue your work).
Saving your data in another format
For some reason or other, you may wish to analyze your data with other software. This 'other software' may be able to read SPSS data, but much more frequently than not this is not the case. SPSS can assist you by saving the data either in a specific format or in a general format that can be read by most software.
Here is a small selection of possibilities.
Saving data as a Stata™ file
SAVE TRANSLATE OUT = 'd:mydirmystatadata.dta' | |
/ TYPE=STATA | |
/ VERSION=8 | |
/ EDITION=SE | |
/ DROP var17 var20 var24 | |
/ REPLACE. |
REPLACE
will do what it looks like doing, i.e. any existing file with the same name will be overwritten. Of course, you may omit this command.
Saving data as a comma delimited file
In this type of file, the data will be in 'raw' format, with each data value separated from the next by a comma. This may be read by a variety of other software.
SAVE TRANSLATE OUT = 'd:mydirmycsvdata.csv' | |
/ TYPE=CSV | |
/ MAP. |
MAP
will produce an exact list of all variables written to the new file. Of course, the DROP
and KEEP
subcommands may be used as well.
Saving data as a tabulator delimited file
Use the same command as with a comma delimited file, but use TYPE=TAB
instead.
How To Open .sav Files Spss
Saving data in a plain ASCII file
To save your data just as raw data and nothing else (no delimiters, no other characters), the command goes like this:
WRTIE OUT = 'd:mydirmyasciidata.txt' TABLE | |
/ var1 var17 var18 to var24. | |
EXECUTE. |
If you just wish to WRITE
the entire data set, use ALL instead of a varlist.
Open Sav File Free
This procedure will produce an ASCII file in FIXED FORMAT (see section Read Raw Data on how to read such a file). Keyword TABLE
will make SPSS produce an exact description of the data set. Note that WRITE
will be accomplished only upon execution of another command or with the help of EXECUTE
, as demonstrated here.
Open Sav File Spss
How To Open Spss File In Excel
© W. Ludwig-Mayerhofer, IGSW | Last update: 16 Sep 2009