Search code examples
deploymentrelative-pathabsolute-pathspss

Specifying relative paths in SPSS 18


In SPSS 11 it was possible to specify relative paths. Example:

FILE HANDLE myfile='..\..\data\current.txt' /LRECL=533.
DATA LIST FILE=myfile /
...

This worked because apparently, SPSS 11 set the working folder to the path where the source .SPS file is saved. It seems that SPSS 18 always sets it's working folder to the installation folder of SPSS itself. Which is not at all the same thing.

Is there an option to change this behaviour? Or am I stuck with changing everything to absolute filenames?


Solution

  • Instead of a relative path, you could define a directory path and use it inside other file handle declarations to save typing:

    FILE HANDLE directoryPath /NAME='C:\Directory\Path\' .
    FILE HANDLE myFile /NAME='directoryPath/fileName.xyz' .
    GET FILE='myFile' .

    This will get the file: C:\Directory\Path\fileName.xyz.

    The direction of the slashes may be important.

    (Works in version 17)