Specifying Relative Paths in SPSS 18

In SPSS 11, relative paths could be specified. 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 file is saved .SPS. It seems that SPSS 18 always installs the working folder in the installation folder of SPSS itself. Which is not at all the same.

Is there any way to change this behavior? Or am I stuck with changing everything to absolute file names?

+3
source share
4 answers

Instead of a relative path, you can define a directory path and use it in other file descriptor declarations to save input:

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

: C:\Directory\Path\fileName.xyz.

.

( 17)

+4

INSERT sps, .

HOST SUBST ( ) .

FILE HANDLE .

Python, CD SPSS, .

,

+2

Python ( ) . , SPSS cd, .

, SPSS.

p.s. SPSS apis Python ( R .NET). SPSS Developer Central, www.spss.com/devcentral. , SPSS Statistics.

,

+2

"CD", . . :

http://www.spss-tutorials.com/change-your-working-directory/

For example, if your default directory is C: \ project, then GET FILE 'data \ data_file.sav'. will open data_file.sav from C: \ project \ data.

And then, after a few minutes, I came across this little python script from jignesh-sutar (see here SPSS Syntax - use the path to the file .

With its python code, you can use the syntax file path as a starting point for all paths in your syntax.

0
source

Source: https://habr.com/ru/post/1748345/


All Articles