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 2006)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 23 Feb 2006 13:52:55 -0500
Reply-To:   Richard Ristow <wrristow@mindspring.com>
Sender:   "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:   Richard Ristow <wrristow@mindspring.com>
Subject:   Re: Parallel tokens: macro problem not yet solved
Comments:   To: King Douglas <king_d@swbell.net>
In-Reply-To:   <20060223154504.10418.qmail@web82009.mail.mud.yahoo.com>
Content-Type:   text/plain; charset=us-ascii; format=flowed; x-avg-checked=avg-ok-18EB711

At 10:45 AM 2/23/2006, King Douglas wrote:

>Folks: I've added one more variable to my sample. I want my macro to >take the first token from "variable name" and match it with the first >token from "variable title", then the second with the second and the >third with the third [...] > >My earlier example simply had a loop within a loop, which provided all >combinations of variable name and title. [A] revision by Richard >Ristow (untested by him) loops through variable names, but keeps the >title constant. > >Everything below my signature is tested and will run in a syntax >window in version 13.

Here's another try, tested this time - as usual, draft output. It runs on the given test data. Or, actually, it doesn't run; the emitted code is comments rather than TABLES syntax; I don't have a TABLES license. (TABLES and CTABLES aren't licensed as one. Weird.) But the emitted comment lines should show how it works.

Apologies that the emitted lines are so long that they wrap.

* Let's see what we can do, by way of debugging . * . First, you can't reassign an argument, which I tried to . * do the first time. . * . In this version, "!HEAD" was always taken out of "!TITLE" . * and "!TAIL" assigned to "!TTITLE", so the argument to . * "!HEAD", and hence the result from it, wouldn't vary even . * if it was OK to reassign "!TITLE" never varied. . * Try: assign "!TITLE" to "!TTAIL" at the beginning, and use . * "!TTAIL" exclusively thereafter. .

. DEFINE !HELP_IT (VARNAME = !TOKENS(3) / TITLE = !TOKENS(3)) !LET !TTAIL = !TITLE !DO !V !IN (!VARNAME) !LET !T = !HEAD(!TTAIL) !LET !TTAIL = !TAIL(!TITLE) * TABLES <null> /OBSERVATION= !V /TABLE = !V BY (STATISTICS) /STATISTICS MEAN((F1.0)'Mean') /TITLE !T.

!DOEND !ENDDEFINE.

PRESERVE. . SET PRINTBACK=ON MPRINT=ON. . !HELP_IT VARNAME = VAR1 VAR2 VAR3 TITLE = "VAR1 TITLE" "VAR2 TITLE" "VAR3 TITLE". 472 M> . 473 M> . 474 M> * TABLES <null> /OBSERVATION= VAR1 /TABLE = VAR1 BY (STATISTICS) /STATISTICS MEAN((F1.0)'Mean') /TITLE "VAR1 TITLE". 475 M> * TABLES <null> /OBSERVATION= VAR2 /TABLE = VAR2 BY (STATISTICS) /STATISTICS MEAN((F1.0)'Mean') /TITLE "VAR2 TITLE". 476 M> * TABLES <null> /OBSERVATION= VAR3 /TABLE = VAR3 BY (STATISTICS) /STATISTICS MEAN((F1.0)'Mean') /TITLE "VAR2 TITLE". 477 M> . RESTORE. 478 M> RESTORE.


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