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.

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.

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.