LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (April 2006)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 21 Apr 2006 12:44:13 -0500
Reply-To:     "Peck, Jon" <peck@spss.com>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         "Peck, Jon" <peck@spss.com>
Subject:      Re: Displaying filenames in SPSS output
Comments: To: Hector Maletta <hmaletta@fibertel.com.ar>
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 GET FILE="fred\data.sav". will look for c:\myfavoritedirectory\data.sav.

And GET FILE="fred\asubdir\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 CD=YES which means change the working directory to the place where the specified file lives. So 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.

HTH Jon Peck SPSS

-----Original Message----- From: Hector Maletta [mailto:hmaletta@fibertel.com.ar] Sent: Friday, April 21, 2006 12:24 PM To: Peck, Jon Cc: SPSSX-L@LISTSERV.UGA.EDU 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 tree. 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?

Hector

-----Mensaje original----- De: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] En nombre de Peck, Jon Enviado el: Friday, April 21, 2006 2:08 PM Para: SPSSX-L@LISTSERV.UGA.EDU 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 automatically.

-----Original Message----- From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of Jennifer Thompson Sent: Friday, April 21, 2006 11:21 AM To: SPSSX-L@LISTSERV.UGA.EDU Subject: [SPSSX-L] Displaying filenames in SPSS output

Dear SPSS-ers,

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,

Jennifer Thompson


Back to: Top of message | Previous page | Main SPSSX-L page