0
votes

I'd like to use a scratch variable with GET FILE command. I start from a file with more than a row and I'd like to open another file with the syntax. I should write the filepath directly in the GET FILE command, but I'm wondering how do the same using a scratch variable as well.

This is an example - not working...

temporary.
string #temp  (a100).
SELECT IF ($casenum =1).
compute #temp= concat("'", 'c:\syntax\trance2\test.sav', "'").
print / #temp.
get file = #temp.
2

2 Answers

1
votes

How you have approached this would only make sense if you had a dataset which stored file names and path locations in a variable that then subsequently needed processing (which is possible to using python).

However you don't reference any variable in your code and explicitly write out a single file location. So it is not entirely clear whether it is this that you want to do, I'm going to assume not, and I so shall provide alternative solutions to what I think it is you maybe wanting to do:

/* Example1: Using macro string substitution */.
DEFINE  !File1 () "C:\Program Files\IBM\SPSS\Statistics\23\Samples\English\Employee data.sav" !ENDDEFINE.
GET FILE=!File1.

/* Example2: Using FILE HANDLE */.
FILE HANDLE File2 /NAME="C:\Program Files\IBM\SPSS\Statistics\23\Samples\English\Demo.sav".
GET FILE=File2.
0
votes

Can't you just concatenation these in the dialog syntax like %%path%%\%%filename%% ?