Date: Fri, 3 Feb 2012 02:08:06 -0800
Reply-To: Albert-Jan Roskam <fomcl@yahoo.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Albert-Jan Roskam <fomcl@yahoo.com>
Subject: access environment variables from within spss
Content-Type: multipart/alternative;
Hi,
How can I the values of environment variables under Spss for Windows? It's easy enough with Python (see below), but can it be done without it? It would be nice if onecould say:
FILE HANDLE mydir /NAME='%homedrive%'.
GET FILE = 'mydir/somefile.sav'.
The goal is to make many syntaxes as invulnerable to path name changes as possible. I experimented with HOST and SHOW ENVIRONMENT a bit, but this will become kludgy at best.
begin program python.
# first way
import os, spss
spss.Submit("file handle mydir0 /name = '%s'." % (os.getenv("temp")))
# second way (only with temp dir)
import tempfile, spss
spss.Submit("file handle mydir /name = '%s'." % (tempfile.gettempdir()))
end program.
Cheers!!
Albert-Jan
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a
fresh water system, and public health, what have the Romans ever done for us?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[text/html]
|