SPSS macro – Repurposing the file path for multiple uses

SPSS macro
I write a TON of SPSS code and work with colleagues around the world as well as on different computers which have different drives – paths available. This SPSS macro shows how you can get around a lot of the headaches dealing with these issues.  There are some other SPSS commands that can be used similarly however I find this exceptionally helpful as I can reference it when I’m merging files, exporting to text / Excel, saving output, etc.

https://www.youtube.com/watch?v=5suzwEyXsG8

SPSS macro

 
/***********************Save file macro********************************.
Define !Sav (File=!TOKENS(1)) Save OutFile=!path+!file+'.sav' /Compressed. !enddefine.
/***********************Get file and show N********************************.
Define !Get (File=!TOKENS(1))
Get File=!path+!file+'.sav'. 
DATASET NAME $DataSet WINDOW=FRONT.
exe.
show n.
!enddefine.

 

Comments are closed.