Date: Wed, 14 May 2008 11:51:32 -0400
Reply-To: Richard Ristow <wrristow@mindspring.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Richard Ristow <wrristow@mindspring.com>
Subject: Re: file writename
In-Reply-To: <006a01c8b53b$8c380a80$4b960823@hc.msu.edu>
Content-Type: text/plain; charset="iso-8859-1"; format=flowed
This has hung unanswered for most of a day, so in
default of a true Script person,
At 04:54 PM 5/13/2008, Jodene Fine wrote:
>I have a script which calls syntax. At the end
>of the syntax, I want to output a text file by
>the name of the current working file, but with a
>different extension (.1D). I have tried this (pseudocode):
>
>1. Initiate script
>2. Interactive input of file to process
>3. Parse path and filename and extension into variables (say strName for the
>filename)
>4. Make a .SAV file using strName
>5. Call syntax, which performs transformations
>6. Syntax writes out a temporary .1D file (temp.1D)
>7. Script uses Name temp.1D as strFilename & ".1D"
>
>It appears that the order of control of this code prevents the Name command
>from executing in the proper order, I think that the Name command is
>executed rather earlier than the syntax is being executed.
I've never been a Scripter, but scripting the
SPSS processor with Sax Basic processor (and
using Visual Basic would probably be the same)
has always had synchronization issues. See
"Synchronizing Scripts and Syntax", pp.284 ff in
the second edition of Raynald Levesque's book(*).
Having the 'Name' command run before the SPSS
processor terminates, would be only too likely.
>As noted above, I can't pass the file name from
>the script to the syntax, but I have a .SAV file with the name I want.
I didn't realize that one was unsolved. So,
writing a macro definition to a file, and
INSERTing it in your syntax file (or vice versa) doesn't work?
>Is there a way to strip the name of the current
>data file using syntax to name the .1D as I
>write it out instead of using a temp.1D file?
That, unfortunately not. The SPSS processor
doesn't have programmatic access to the file names.
>Oh, BTW, I'm working in (sigh) v15. No Python.
But 15 has Python. Mis-typing the version number?
-With warmest regards,
Richard
.....................
(*)Levesque, Raynald, "SPSSŪ Programming and Data
Management, 2nd Edition/A Guide for SPSSŪ and
SASŪ Users". SPSS, Inc., Chicago, IL, 2005
(NOT later editions, which have much less about macros and scripting.)
=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
|