I am currently saving files to an absolute file path SAVE OUTFILE='my/path/to/file.sav'. This is not optimal, so I would like to save files in dynamic / relative file paths, for example SAVE OUTFILE='file.sav'.
Therefore, I need to set the current directory, but it also works the same as it did CD 'my/path/to/', and then save. But I wonder if SPSS cannot automatically set the directory when opening files? We, as a rule, have a lot of people working with the same syntax, and we always have to change the absolute paths to files.
Edit: As Jignesh Sutar said, I can use the python extension. So I thought I could use something simple:
BEGIN PROGRAM.
import spss,spssaux, os, SpssClient
SpssClient.StartClient()
path = SpssClient.GetCurrentDirectory()
print path
spss.Submit(r"""CD = '%s'.""" % (path))
SpssClient.StopClient()
END PROGRAM.
But the above will simply output the script and nothing else, however another simple case:
BEGIN PROGRAM.
import spss
firstvar=spss.GetVariableName(0)
print firstvar
END PROGRAM.
.