Date: Fri, 21 Apr 2006 12:44:13 -0500
Reply-To: "Peck, Jon" <firstname.lastname@example.org>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: "Peck, Jon" <email@example.com>
Subject: Re: Displaying filenames in SPSS output
Content-Type: text/plain; charset="UTF-8"
I am not sure that I understand your problem, but here are some thoughts.
SPSS maintains a working directory that is used for all relative-path references to files in syntax. If you write get file='fred.sav', it will look in the current working directory for it.
This is not necessarily the directory that is current for the gui. The intention is that gui actions should not change the behavior of your syntax job.
You can set the working directory explicitly with the CD command and display it with SHOW DIRECTORY. Its initial state is determined by the installation directory or the desktop shortcut that launched SPSS.
The best solution, IMO, is to use FILE HANDLE to define either the file or the path to the file. If I do
FILE HANDLE fred NAME="c:/myfavoritedirectory".
I can then write
will look for c:\myfavoritedirectory\data.sav.
will look for c:\myfavoritedirectory\asubdir\data.sav.
You can define a file handle at the top of your job stream and then just refer to it, and you can redefine it at any point in the job if needed.
This works for INCLUDE and INSERT commands, too, if you need to locate a syntax file.
INSERT also has a keyword
which means change the working directory to the place where the specified file lives.
INSERT FILE="fred\mysyntax.sps" CD=YES.
will both read the syntax file and change the working directory to the location of that file. Then subsequent syntax that has a relative path will look the directory where mysyntax.sps lives.
If you are using Python programmability, there are many other options for working with and referring to files in SPSS both through standard Python libraries and SPSS extra modules.
From: Hector Maletta [mailto:firstname.lastname@example.org]
Sent: Friday, April 21, 2006 12:24 PM
To: Peck, Jon
Subject: RE: Displaying filenames in SPSS output
A related problem is writing file specs in syntax without having to open the
respective file. The specs for the current file are echoed to the output
when the file is opened, and could be copied to syntax from there, but how
to specify other files is more difficult. This may happen, for instance,
when you have opened file A, and want to write syntax to match file A with
other files B, C and D.
Back in the DOS era, you could write C:fileA.sav and DOS would dutifully go
to the current directory (folder for the new generations), but it does not
seem to work nowadays: you have to write down the complete specs from C:\My
documents\... down to your filename through all the levels in the folders
Having the specs written beforehand in some kind of macro does not help
much, as the relevant file locations change frequently. One kind of solution
I dream of would be to open the File Open box and click on the desired file,
to produce the written specs of the file in your syntax window.
Of course to this effect one could use the Paste option after choosing Merge
Files in the menu, but that is pretty poor (only one external file allowed).
Any other suggestion?
De: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] En nombre de Peck,
Enviado el: Friday, April 21, 2006 2:08 PM
Asunto: Re: Displaying filenames in SPSS output
Remember that the filename (the data file, I presume) is always included in
the Notes table. That table is closed by default, but you can control this
setting in your option settings.
In SPSS 14, which supports multiple concurrently open datasets, you normally
see the dataset and file name displayed as a visible part of the output
From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of
Sent: Friday, April 21, 2006 11:21 AM
Subject: [SPSSX-L] Displaying filenames in SPSS output
Just a quickie...
Could anyone tell me how to display a filename in the SPSS output? I am
running the same analysis syntax routine on a bunch of different SPSS files
and, for each datafile, a few tables are produced. It would be very helpful
to have the filename displayed before the tables - just to make it easier to
look through the data, if you see what I mean.
Thanks for reading,