Date: Tue, 14 Oct 2003 11:23:00 -0500
Reply-To: Dawn Kernen <Dawn.Kernen@SUMMITMARKETING.COM>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Dawn Kernen <Dawn.Kernen@SUMMITMARKETING.COM>
Subject: Setting a Constant for Multiple Macros
Content-Type: text/plain; charset="iso-8859-1"
I have several reports/analyses that need to be run for many different clients. I would like to wrap the analysis macros within a larger macro, so I
only have the give the client information once (the client information, a three-character acronym, is in its own respective SQL table accessed via
ODBC).
The difficulty I am having is setting a constant value for the year. I need to have the year be a token in many macros, but I cannot figure out how to
pass that value to other macros. In other words, I want a fixed constant to be available to many other macros. Each report needs to be a separate
macros, because I use them both together and individually.
1) Can a !LET command keep a macro variable - even after the !ENDDEFINE?
2) Can a !DEFAULT command utilize system variables like this? (I couldn't get this to work.)
DEFINE !MYMACRO (ARG1 = !DEFAULT XDATE.YEAR($TIME) !TOKENS(1)).
3) If I set a !LET statement in the large/wrap-up macro, can I use that constant (!LET !A=2003) in subsequent macro calls? (I tried this, too,
unsuccessfully. Something like a macro call: !RPT1 arg1=!A.)
Here's a pared down version of what I've tried (unsuccessfully):
*MACRO TO DEFINE THE YEAR.
DEFINE !CURYEAR ().
!LET !YEARC=1999. (?????)
!ENDDEFINE.
***.
*MACRO FOR REPORT1.
DEFINE !RPT1 ().
COMPUTE filter_$=(XDATE.YEAR(LAST_DAT)=!YEARC).
FILTER BY filter_$.
EXECUTE .
T-TEST
GROUPS=group(1 0)
/MISSING=ANALYSIS
/VARIABLES=gross_in
/CRITERIA=CIN(.95) .
FILTER OFF.
USE ALL.
EXECUTE .
!ENDDEFINE.
***.
*MACRO FOR REPORT2.
DEFINE !RPT2 ()
FLITER OFF.
USE ALL.
COMPUTE filter_$=(year>=!YEARC-2).
FORMAT filter_$ (f1.0).
FILTER BY filter_$.
EXECUTE .
FREQUENCIES
VARIABLES=year
/ORDER= ANALYSIS .
!ENDDEFINE.
***.
*MACRO TO WRAP THINGS TOGETHER AND REQUEST CLIENT.
DEFINE !CLARITY (!POSITIONAL !TOKENS(1)).
GET
!CONCAT(" FILE='C:\",!1,"_TEST.sav'.").
!RPT1.
!RPT2.
!ENDDEFINE.
!CLARITY ALM.
Thanks in advance! I've been struggling with this for days!
Dawn