Date: Sun, 14 Nov 1999 09:24:50 -0500
Reply-To: "James B. Luther, Ph.D." <jluther@ALUMNI.INDIANA.EDU>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: "James B. Luther, Ph.D." <jluther@ALUMNI.INDIANA.EDU>
Subject: Re: Macro variable question-incrementing values
Content-Type: text/plain; charset="iso-8859-1"
While it's true you can't do math in Macros, there is a facility for
looping, and you can change the increment on the looping. I can't tell from
the SAS snippet exactly what you are trying to do, but you might check that
out if you are basically trying to control looping. Maybe post/send a larger
snippet so we can tell what you want to do. I've done a fair amount of
translating SAS Macros to SPSS for one customer, and usually end up using
scripting, but sometimes it can be accomplished with a macro with a lot less
code.
Jim Luther
jluther@lutherconsulting.com
-----Original Message-----
From: John Hendrickx <john_hendrickx@YAHOO.COM>
Newsgroups: bit.listserv.spssx-l
To: SPSSX-L@LISTSERV.UGA.EDU <SPSSX-L@LISTSERV.UGA.EDU>
Date: Saturday, November 13, 1999 12:56 PM
Subject: Re: Macro variable question-incrementing values
>--- Daniel Sharp <dmsharp@MADISON.TEC.WI.US> wrote:
>> I have a problem changing the value of a macro
>> variable in a macro I'm writing. I'm familiar with
>> how this is done in SAS macro language and (since
>> I'm roughly translating a SAS macro into a SPSS
>> macro) I'm looking trying to figure out how to do
>> this.
>>
>> I have a variable !k that I want to increment. In
>> SAS it goes like this:
>> %let k=%eval(&k+1).
>>
>> (as far as I can tell, !eval in SPSS is nothing like
>> %eval in SAS so I'm not using it ).
>>
>> I have tried
>> !let !k=!k+1 -but that's not working.
>>
>You can't perform arithmetic with macro variables in
>SPSS. All macro variables are basically strings. In
>some cases you can kluge something together using
>!concat() and !length, but that's the limit.
>
>You might try scripting. It's powerful enough, but the
>learning curve is steep and it's not well documented.
>
>Good luck,
>John Hendrickx
>
>> Any hints?
>>
>> Thanks much.
>> Dan Sharp
>> dmsharp@madison.tec.wi.us
>>
>
>
>=====
>
>__________________________________________________
>Do You Yahoo!?
>Bid and sell for free at http://auctions.yahoo.com
>
|