Date: Tue, 17 Nov 2009 14:04:07 -0700
Reply-To: Jon K Peck <peck@us.ibm.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Jon K Peck <peck@us.ibm.com>
Subject: Re: SPSS Macro Variables
In-Reply-To: <7.0.1.0.2.20091117154431.03607738@mindspring.com>
Content-Type: multipart/alternative;
See below.
Jon Peck
SPSS, an IBM Company
peck@us.ibm.com
312-651-3435
From:
Richard Ristow <wrristow@mindspring.com>
To:
SPSSX-L@LISTSERV.UGA.EDU
Date:
11/17/2009 01:57 PM
Subject:
Re: [SPSSX-L] SPSS Macro Variables
Sent by:
"SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
At 03:21 PM 11/16/2009, Michael W. Bates wrote:
>I'm a 10 year SAS user who's fairly new to SPSS. I and importing 5
>excel files with dates in the filename, and would like to be able to
>change the date once in my code and import all 5 files.
>
>define !import1 () 'D:\Reports\Daily\Production File 1 Nov 16 2009.xls' !
>enddefine.
>
>I would like to the 'Nov 16' once and concatenate that with the rest
>of the macro variables, so I don't have to make 5 changes. SPSS
>doesn't seem to like it when I try to define a separate macro
>variable for the 'Nov 16'.
OK, here's the shock for SAS macro users:
a) You can't create or assign a value to a macro variable except within a
macro
b) Macro variables do not persist after the macro they belong to.
They are not available in another macro.
>>> But you can use the !EVAL function to evaluate a macro within a macro.
That might solve the problem here.
The standard SPSS solution is to make the date string an argument to
the macro. I'd love to work that out, and may in a bit, but I'm both
rusty and pressed for time.
>>> But a better solution is to use Python programmability, which is much
more powerful and flexible and has none of these problems.
Regards,
Jon Peck
-Best of luck,
Richard
=====================
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
[text/html]