"spssaux.GetCurrentlyActiveFileName()"

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

"spssaux.GetCurrentlyActiveFileName()"

Albert-Jan Roskam
Hi,

I made a small program that compares the contents of an Spss syntax against the variable list of the active datafile. Purpose is to easily create a KEEP statement at the beginning of the file (GET command). Keeping only the needed vars speeds up processing. Currently, the user has to specify to parameters, named 'sav' and 'sps'. Sav is the datafile name, and sps can be either a piece of syntax, or an .sps file.

However, I'd would like to use the currently active dataset as the default value for 'sav', but there is no such thing as a "spssaux.GetCurrentlyActiveFileName()" function. Or is there? Perhaps finding the *active* file is what makes it problematic.

In addition, raw_input(prompt) does not work under Spss. Does that mean I'd have to create a GUI if I still want to run it from within Spss? I reckon it'd be a nice exercise to make a program where you paste the syntax in field #in, hit a button, and copy-paste it from field #out.

Thanks in advance!

Albert-Jan

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (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
Reply | Threaded
Open this post in threaded view
|

Re: "spssaux.GetCurrentlyActiveFileName()"

Peck, Jon
-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Albert-Jan Roskam
Sent: Thursday, September 10, 2009 4:54 AM
To: [hidden email]
Subject: [SPSSX-L] "spssaux.GetCurrentlyActiveFileName()"

Hi,

I made a small program that compares the contents of an Spss syntax against the variable list of the active datafile. Purpose is to easily create a KEEP statement at the beginning of the file (GET command). Keeping only the needed vars speeds up processing. Currently, the user has to specify to parameters, named 'sav' and 'sps'. Sav is the datafile name, and sps can be either a piece of syntax, or an .sps file.

However, I'd would like to use the currently active dataset as the default value for 'sav', but there is no such thing as a "spssaux.GetCurrentlyActiveFileName()" function. Or is there? Perhaps finding the *active* file is what makes it problematic.
[peck]
Take a look at the getDatasetInfo function in the spssaux module.

In addition, raw_input(prompt) does not work under Spss. Does that mean I'd have to create a GUI if I still want to run it from within Spss? I reckon it'd be a nice exercise to make a program where you paste the syntax in field #in, hit a button, and copy-paste it from field #out.
[peck] Right.  You can't use raw input within a program.  The easiest solution with v 17 or later is to use the Custom Dialog Builder to collect the information from the user.  Otherwise you can use Tkinter, wxPython or another gui tool to pop up a dialog.  In the case of wxPython there is a simple, prepackaged dialog with a text input field.  However, wxPython has to be installed separately, and you have to be careful in older SPSS versions to avoid conflicts between the SPSS gui and the gui used

Thanks in advance!

Albert-Jan

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (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

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (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
Reply | Threaded
Open this post in threaded view
|

Re: "spssaux.GetCurrentlyActiveFileName()"

Richard Ristow
In reply to this post by Albert-Jan Roskam
At 06:53 AM 9/10/2009, Albert-Jan Roskam wrote:

>I made a small program that compares the contents of an Spss syntax
>against the variable list of the active datafile.

So, you've written a variable cross-reference utility for SPSS
programs? That's valuable in itself. Would you post it?

-Thanks,
  Richard

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (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