LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (February 2010)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 25 Feb 2010 13:39:43 -0800
Reply-To:   ksven <svenklingemann@gmail.com>
Sender:   "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:   ksven <svenklingemann@gmail.com>
Subject:   Re: Macro to relabel variables - help needed
In-Reply-To:   <27714526.post@talk.nabble.com>
Content-Type:   text/plain; charset=us-ascii

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:

(....

!doend 3339 M> !doend !enddefine. 3340 M> !enddefine. !relabel vnames=1 2 3/vnames1=!list1. 3341 M> 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 (?)

Best, Sven

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. >> !doend >> !enddefine. >> !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() >> "James" >> "Paul" >> "Mary" >> !ENDDEFINE. >> >> so that I would invoke the macro as follows: !relabel vnames=1 2 >> 3/vnames1=!list1. >> >> That does not work though ...? >> >> Any ideas? >> Thanks! >> Sven >> >> > > 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: > > http://www.angelfire.com/wv/bwhomedir/spss/macros_for_var_lists.txt > > > 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 > !ENDDEFINE. > > !relabel vnames=1 2 3/vnames1=!list1. > > It probably won't make any difference, but that's what I'd try for > starters. > > 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 SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD


Back to: Top of message | Previous page | Main SPSSX-L page