FILE HANDLE base /NAME = "H:\ProjectX".įILE HANDLE report /NAME = "base\Reports" every GET FILE, or GET TRANSLATE, or SAVE).Īnother trick you can use is that you can stack multiple file handles together. If you used absolute references you would need to edit the file at every location you used that absolute path (e.g.
#Fire.sps spss code code#
If you use file handles, all you need to do is change the one line of code at the top of your syntax. Say I needed to move where I saved the files from my personal drive to a work H drive. SAVE OUTFILE = "save\TransformedData1.sav"īesides being shorter, this greatly aids when you need to move files around. *SAVE OUTFILE = "C:\Users\axw161530\Dropbox\Documents\BLOG\FileHandles_SPSS\TransformedData1.sav" The same works for where I save the files, so I would use the second SAVE line instead of the first after I’ve defined a file handle. I can just write something like: GET FILE = "data\SPSS_Dataset1.sav". So what this does instead of having to write something like: GET FILE = "H:\ProjectX\OriginalData\SPSS_Dataset1.sav". What those commands go are point to particular locations on my machine that either have the data I will use for the syntax, and where to save the subsequent results. *Simple description here of what the syntax does.įILE HANDLE data /NAME = "H:\ProjectX\OriginalData".įILE HANDLE save /NAME = "C:\Users\axw161530\Dropbox\Documents\BLOG\FileHandles_SPSS". For example, here is basically what most of my syntax’s look like at the top. To aid in reproducible analysis, I often have a set of FILE HANDLE commands at the header of my syntax.