Hi Bruce -
thanks for the suggestion. The !quote command works.
Substituting the var list with the macro still does not work though ... this
is the error message I get:
3339 M> !doend
3340 M> !enddefine.
!relabel vnames=1 2 3/vnames1=!list1.
3342 M> .
3343 M> variable labels I1 ''.
3344 M> variable labels I2 ''.
3345 M> variable labels I3 ''.
3346 M> .
3347 M> .
3348 M> .
3349 M> .
3350 M> .
3351 M> .
3352 M> .
3353 M> James Mary John
>Error # 1. Command name: James
>The first word in the line is not recognized as an SPSS command.
>This command not executed.
3354 M> .
I read through the link you gave me and changed the syntax of my macro
generating the variable list, but got the same error message independent of
the changes. Not sure what the problem is (?)
Bruce Weaver wrote:
> ksven wrote:
>> Hi Bruce - that was helpful.
>> I did manage to get this to work:
>> define !relabel (vnames=!charend ("/") /vnames1=!cmdend)
>> !LET !vnamescopy=!vnames1
>> !DO !cnt !in (!vnames)
>> !LET !cnt1 = !HEAD(!vnamescopy)
>> !LET !vnamescopy=!TAIL(!vnamescopy)
>> variable labels !concat("I",!cnt) !cnt1.
>> !relabel vnames=1 2 3/vnames1="James" "Paul" "Mary".
>> The one thing that is not working though is that I want to use a macro
>> that contains all of my variable labels and insert it in this macro:
>> DEFINE !list1()
>> so that I would invoke the macro as follows: !relabel vnames=1 2
>> That does not work though ...?
>> Any ideas?
> I know that using macros for variable lists can be a bit tricky. One of
> my colleagues wrote a little document a few years ago on some of the
> problems he encountered. I don't think it addresses your problem
> specifically, but here it is anyway:
> I've found that quotes can be a bit finicky in macros too. One thing you
> could try is changing this line:
> variable labels !concat("I",!cnt) !cnt1.
> to this:
> variable labels !concat("I",!cnt) !QUOTE(!cnt1).
> To call it, then:
> !relabel vnames=1 2 3/vnames1=James Paul Mary.
> Or with the !list macro:
> DEFINE !list1() James Paul Mary
> !relabel vnames=1 2 3/vnames1=!list1.
> It probably won't make any difference, but that's what I'd try for
> David Marso...if you're reading this, please step in and straighten us
> out! ;-)
View this message in context: http://old.nabble.com/Macro-to-relabel-variables---help-needed-tp27714472p27714530.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.
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