Date: Tue, 17 Nov 2009 14:04:07 -0700
Reply-To: Jon K Peck <firstname.lastname@example.org>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Jon K Peck <email@example.com>
Subject: Re: SPSS Macro Variables
SPSS, an IBM Company
Richard Ristow <firstname.lastname@example.org>
11/17/2009 01:57 PM
Re: [SPSSX-L] SPSS Macro Variables
"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' !
>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
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.
-Best of luck,
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
For a list of commands to manage subscriptions, send the command