Inserting macro var within TITLE

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

Inserting macro var within TITLE

Susan-23
Hello,

I am a new SPSS user. I have a simple question regarding macro vars. I
have a program where I want to change the part of title of a custom table
to reflect a new fiscal year, e.g., TITLE="FY 2005: # served clients".

I created a macro var for fiscal year. However, I don't know how to
successfully put it in the custom table's title. In SAS, you'd do: %let
thisFY=2005; TITLE "FY &thisFY: # served clients"; Is it just as easy in
SPSS? I've tried many permutations with !quote, !unquote, etc. and am at a
loss.

Thanks for any help you can give,
Susan
Reply | Threaded
Open this post in threaded view
|

Re: Inserting macro var within TITLE

Spousta Jan
Hello Susan,

An example:

define myTable (!pos=!cmd)

GET FILE='C:\Program Files\SPSS\Cars.sav'.
select if origin = !1 and year = 70.

* define your own title.
!let !title = !quote(!concat('Case Summaries ', !1))

* and use it in the command.
SUMMARIZE
 /TABLES= origin horse accel
 /FORMAT=LIST NOCASENUM TOTAL
 /TITLE= !title
 /MISSING=VARIABLE
 /CELLS=COUNT .

!enddefine.


myTable 1.
myTable 2.
myTable 3.

Hope this helps you.

Jan


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Susan
Sent: Tuesday, January 02, 2007 9:26 PM
To: [hidden email]
Subject: Inserting macro var within TITLE

Hello,

I am a new SPSS user. I have a simple question regarding macro vars. I
have a program where I want to change the part of title of a custom
table to reflect a new fiscal year, e.g., TITLE="FY 2005: # served
clients".

I created a macro var for fiscal year. However, I don't know how to
successfully put it in the custom table's title. In SAS, you'd do: %let
thisFY=2005; TITLE "FY &thisFY: # served clients"; Is it just as easy in
SPSS? I've tried many permutations with !quote, !unquote, etc. and am at
a loss.

Thanks for any help you can give,
Susan