Administrator
|
It should be documented...
DEFINE !Vars ( ) v01 TO v05 !ENDDEFINE . DO REPEAT function=SUM MEAN SD /result=S M ST. COMPUTE result=function(!Vars ) . END REPEAT PRINT. 155 0 +COMPUTE S=SUM(v01 TO v05 156 0 + ) 157 0 +COMPUTE M=MEAN(v01 TO v05 158 0 + ) 159 0 +COMPUTE ST=SD(v01 TO v05 160 0 + ) ----- Please reply to the list and not to my personal email. Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" -- Sent from: http://spssx-discussion.1045642.n5.nabble.com/ ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (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
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
It's an interesting example, but it follows from the normal macro expansion mechanism, so I don't see anything to document. On Wed, Sep 19, 2018 at 12:41 PM David Marso <[hidden email]> wrote: It should be documented... |
In reply to this post by David Marso
Sure, DO REPEAT is that mechanical and dumb in generating lines. That fact does not really need
more documentation.
I don't understand why the close-parenthesis shows up on a separate line. You defined !vars
without a carriage-return/line-feed. But that detail (new lines) of Macro-parsing is a small
enough problem that I always tried to ignore it.
--
Rich Ulrich
From: SPSSX(r) Discussion <[hidden email]> on behalf of David Marso <[hidden email]>
Sent: Wednesday, September 19, 2018 2:41 PM To: [hidden email] Subject: I didn't think something like this would work but it does ;-) It should be documented...
DEFINE !Vars ( ) v01 TO v05 !ENDDEFINE . DO REPEAT function=SUM MEAN SD /result=S M ST. COMPUTE result=function(!Vars ) . END REPEAT PRINT. 155 0 +COMPUTE S=SUM(v01 TO v05 156 0 + ) 157 0 +COMPUTE M=MEAN(v01 TO v05 158 0 + ) 159 0 +COMPUTE ST=SD(v01 TO v05 160 0 + ) ----- Please reply to the list and not to my personal email. Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" -- Sent from: http://spssx-discussion.1045642.n5.nabble.com/ ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (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 |
Administrator
|
In reply to this post by Jon Peck
But how many users equate DO REPEAT with MACRO. Some old timer from SPSS
probably Tex or J Fry, maybe Bill H. and I had an exchange one Late Friday afternoon which confirmed that DO REPEAT was the first SPSS foray into macro type functionality. The docs refer to variables and values. One only infers for the DO REPEAT kinda= MACRO that functions are also fair game. I never tried it until today so go figure. Jon Peck wrote > It's an interesting example, but it follows from the normal macro > expansion > mechanism, so I don't see anything to document. > > On Wed, Sep 19, 2018 at 12:41 PM David Marso < > david.marso@ > > wrote: > >> It should be documented... >> >> DEFINE !Vars ( ) v01 TO v05 !ENDDEFINE . >> >> DO REPEAT function=SUM MEAN SD /result=S M ST. >> COMPUTE result=function(!Vars ) . >> END REPEAT PRINT. >> >> 155 0 +COMPUTE S=SUM(v01 TO v05 >> 156 0 + ) >> 157 0 +COMPUTE M=MEAN(v01 TO v05 >> 158 0 + ) >> 159 0 +COMPUTE ST=SD(v01 TO v05 >> 160 0 + ) >> >> >> >> >> ----- >> Please reply to the list and not to my personal email. >> Those desiring my consulting or training services please feel free to >> email me. >> --- >> "Nolite dare sanctum canibus neque mittatis margaritas vestras ante >> porcos >> ne forte conculcent eas pedibus suis." >> Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff >> in >> abyssum?" >> -- >> Sent from: http://spssx-discussion.1045642.n5.nabble.com/ >> >> ===================== >> To manage your subscription to SPSSX-L, send a message to >> > LISTSERV@.UGA > (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 >> > > > -- > Jon K Peck > jkpeck@ > > ===================== > To manage your subscription to SPSSX-L, send a message to > LISTSERV@.UGA > (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 ----- Please reply to the list and not to my personal email. Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" -- Sent from: http://spssx-discussion.1045642.n5.nabble.com/ ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (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
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
Maybe the CSR should have a section entitled "Marso's Musings". On Wed, Sep 19, 2018 at 1:51 PM David Marso <[hidden email]> wrote: But how many users equate DO REPEAT with MACRO. Some old timer from SPSS |
Administrator
|
With a sub-section titled JKP's counters.
Jon Peck wrote > Maybe the CSR should have a section entitled "Marso's Musings". > > On Wed, Sep 19, 2018 at 1:51 PM David Marso < > david.marso@ > > wrote: > >> But how many users equate DO REPEAT with MACRO. Some old timer from SPSS >> probably Tex or J Fry, maybe Bill H. and I had an exchange one Late >> Friday >> afternoon which confirmed that DO REPEAT was the first SPSS foray into >> macro >> type functionality. The docs refer to variables and values. One only >> infers >> for the DO REPEAT kinda= MACRO that functions are also fair game. I >> never >> tried it until today so go figure. >> >> >> Jon Peck wrote >> > It's an interesting example, but it follows from the normal macro >> > expansion >> > mechanism, so I don't see anything to document. >> > >> > On Wed, Sep 19, 2018 at 12:41 PM David Marso < >> >> > david.marso@ >> >> > > wrote: >> > >> >> It should be documented... >> >> >> >> DEFINE !Vars ( ) v01 TO v05 !ENDDEFINE . >> >> >> >> DO REPEAT function=SUM MEAN SD /result=S M ST. >> >> COMPUTE result=function(!Vars ) . >> >> END REPEAT PRINT. >> >> >> >> 155 0 +COMPUTE S=SUM(v01 TO v05 >> >> 156 0 + ) >> >> 157 0 +COMPUTE M=MEAN(v01 TO v05 >> >> 158 0 + ) >> >> 159 0 +COMPUTE ST=SD(v01 TO v05 >> >> 160 0 + ) >> >> >> >> >> >> >> >> >> >> ----- >> >> Please reply to the list and not to my personal email. >> >> Those desiring my consulting or training services please feel free to >> >> email me. >> >> --- >> >> "Nolite dare sanctum canibus neque mittatis margaritas vestras ante >> >> porcos >> >> ne forte conculcent eas pedibus suis." >> >> Cum es damnatorum possederunt porcos iens ut salire off sanguinum >> cliff >> >> in >> >> abyssum?" >> >> -- >> >> Sent from: http://spssx-discussion.1045642.n5.nabble.com/ >> >> >> >> ===================== >> >> To manage your subscription to SPSSX-L, send a message to >> >> >> >> > LISTSERV@.UGA >> >> > (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 >> >> >> > >> > >> > -- >> > Jon K Peck >> >> > jkpeck@ >> >> > >> > ===================== >> > To manage your subscription to SPSSX-L, send a message to >> >> > LISTSERV@.UGA >> >> > (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 >> >> >> >> >> >> ----- >> Please reply to the list and not to my personal email. >> Those desiring my consulting or training services please feel free to >> email me. >> --- >> "Nolite dare sanctum canibus neque mittatis margaritas vestras ante >> porcos >> ne forte conculcent eas pedibus suis." >> Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff >> in >> abyssum?" >> -- >> Sent from: http://spssx-discussion.1045642.n5.nabble.com/ >> >> ===================== >> To manage your subscription to SPSSX-L, send a message to >> > LISTSERV@.UGA > (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 >> > > > -- > Jon K Peck > jkpeck@ > > ===================== > To manage your subscription to SPSSX-L, send a message to > LISTSERV@.UGA > (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 ----- Please reply to the list and not to my personal email. Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" -- Sent from: http://spssx-discussion.1045642.n5.nabble.com/ ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (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
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
In reply to this post by David Marso
An example like this in the DO REPEAT documentation would be nice. Of course, almost no user ever asks for LESS documentation. On Wed, Sep 19, 2018 at 1:41 PM David Marso <[hidden email]> wrote: It should be documented... |
They just don't read it. On Wed, Sep 19, 2018 at 2:26 PM Rick Oliver <[hidden email]> wrote:
-- |
Administrator
|
In reply to this post by Rick Oliver
Yes, I agree. On Wed, Sep 19, 2018, 4:26 PM Rick Oliver <[hidden email]> wrote:
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
In reply to this post by Rick Oliver
I’m stunned that (a) a do repeat can name functions as arguments for the stand-in variable and those functions will execute when embedded in otherwise valid statements
and (b) that a macro can be named as an argument to a function and the function can process the macro. I look at the basic specification and syntax rules (v25: pages 651-2) and I read ‘variable or value list’ and would never construe (naively, too limited
a vision) a function name or a macro name to be a valid element of a variable or value list. Courtesy of David Marso and others, I’ve noticed that what the manual doesn’t say won’t work may well work. Experimental programming is needed to test things. More
complete documentation would be better. And, you’re right, people—yeah, me too--won’t read it or read it correctly. Interesting, thank you. Gene Maguin From: SPSSX(r) Discussion <[hidden email]>
On Behalf Of Rick Oliver An example like this in the DO REPEAT documentation would be nice. Of course, almost no user ever asks for LESS documentation. On Wed, Sep 19, 2018 at 1:41 PM David Marso <[hidden email]> wrote:
===================== To manage your subscription to SPSSX-L, send a message to
[hidden email] (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
|
In reply to this post by David Marso
Given the the documentation for macr
===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (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 |
In reply to this post by David Marso
Given the the documentation for macro is subpisspoor , I am frequently discovering INTERESTING things.
DEFINE !X (!POS TOKENS(1)) ECHO QUOTE(!1). !ENDDEFINE. DEFINE !Y(!POS TOKENS(1)) ECHO QUOTE(!1). !ENDDEFINE. DEFINE Drive (!POS TOKENS(1)/POS TOKENS(1)) ECHO QUOTE(!1). ECHO QUOTE(!2). !CONCAT("!",!1) !2. ENDDEFINE. Drive X 1. Drive Y 2. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (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 |
Like the macro facility itself, don't expect the documentation to change anytime soon. On Thu, Sep 20, 2018 at 6:21 AM David Marso <[hidden email]> wrote: Given the the documentation for macro is subpisspoor , I am frequently discovering INTERESTING things. |
Administrator
|
In reply to this post by David Marso
Nice one, David. I did not know functions could be used in DO-REPEAT like
that. If you don't mind, I'll add a DATA LIST to create a small dataset and upload that to my SPSS page sometime. I'll include the link for this thread too. Cheers, Bruce David Marso wrote > It should be documented... > > DEFINE !Vars ( ) v01 TO v05 !ENDDEFINE . > > DO REPEAT function=SUM MEAN SD /result=S M ST. > COMPUTE result=function(!Vars ) . > END REPEAT PRINT. > > 155 0 +COMPUTE S=SUM(v01 TO v05 > 156 0 + ) > 157 0 +COMPUTE M=MEAN(v01 TO v05 > 158 0 + ) > 159 0 +COMPUTE ST=SD(v01 TO v05 > 160 0 + ) > > > > > ----- > Please reply to the list and not to my personal email. > Those desiring my consulting or training services please feel free to > email me. > --- > "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos > ne forte conculcent eas pedibus suis." > Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in > abyssum?" > -- > Sent from: http://spssx-discussion.1045642.n5.nabble.com/ > > ===================== > To manage your subscription to SPSSX-L, send a message to > LISTSERV@.UGA > (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 ----- -- Bruce Weaver [hidden email] http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." NOTE: My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. -- Sent from: http://spssx-discussion.1045642.n5.nabble.com/ ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (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
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
Administrator
|
I was unaware of such niceties prior to yesterday. Does make sense when you
think about it too much. Do feel free to do so. One of these days I must write up my appendix to the FM. Not that IBM would give a FF. ---- Bruce Weaver wrote > Nice one, David. I did not know functions could be used in DO-REPEAT like > that. If you don't mind, I'll add a DATA LIST to create a small dataset > and > upload that to my SPSS page sometime. I'll include the link for this > thread > too. > > Cheers, > Bruce > > > David Marso wrote >> It should be documented... >> >> DEFINE !Vars ( ) v01 TO v05 !ENDDEFINE . >> >> DO REPEAT function=SUM MEAN SD /result=S M ST. >> COMPUTE result=function(!Vars ) . >> END REPEAT PRINT. >> >> 155 0 +COMPUTE S=SUM(v01 TO v05 >> 156 0 + ) >> 157 0 +COMPUTE M=MEAN(v01 TO v05 >> 158 0 + ) >> 159 0 +COMPUTE ST=SD(v01 TO v05 >> 160 0 + ) >> >> >> >> >> ----- >> Please reply to the list and not to my personal email. >> Those desiring my consulting or training services please feel free to >> email me. >> --- >> "Nolite dare sanctum canibus neque mittatis margaritas vestras ante >> porcos >> ne forte conculcent eas pedibus suis." >> Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff >> in >> abyssum?" >> -- >> Sent from: http://spssx-discussion.1045642.n5.nabble.com/ >> >> ===================== >> To manage your subscription to SPSSX-L, send a message to > >> LISTSERV@.UGA > >> (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 > > > > > > ----- > -- > Bruce Weaver > bweaver@ > http://sites.google.com/a/lakeheadu.ca/bweaver/ > > "When all else fails, RTFM." > > NOTE: My Hotmail account is not monitored regularly. > To send me an e-mail, please use the address shown above. > > -- > Sent from: http://spssx-discussion.1045642.n5.nabble.com/ > > ===================== > To manage your subscription to SPSSX-L, send a message to > LISTSERV@.UGA > (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 ----- Please reply to the list and not to my personal email. Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" -- Sent from: http://spssx-discussion.1045642.n5.nabble.com/ ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (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
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
In reply to this post by David Marso
While on macros and do repeat... Some time ago I tried to reuse a macro for
repeated variables without luck... DATA LIST list / x y (2F8.0). BEGIN DATA 2 2 END DATA. DEFINE !Calc (!POSITIONAL !TOKENS(1)) !LET !sq = !CONCAT(!1, "_sqr") COMPUTE !sq = !1 * !1. !ENDDEFINE. DO REPEAT var = x y. !Calc var. END REPEAT PRINT. LIST. output: x y var_sqr 2 2 4 Number of cases read: 1 Number of cases listed: 1 I had to rewrite and use the !DO !v !IN (!1)...!DOEND construct to move the repeat inside the macro. /PR David Marso wrote > It should be documented... > > DEFINE !Vars ( ) v01 TO v05 !ENDDEFINE . > > DO REPEAT function=SUM MEAN SD /result=S M ST. > COMPUTE result=function(!Vars ) . > END REPEAT PRINT. > > 155 0 +COMPUTE S=SUM(v01 TO v05 > 156 0 + ) > 157 0 +COMPUTE M=MEAN(v01 TO v05 > 158 0 + ) > 159 0 +COMPUTE ST=SD(v01 TO v05 > 160 0 + ) > > > > > ----- > Please reply to the list and not to my personal email. > Those desiring my consulting or training services please feel free to > email me. > --- > "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos > ne forte conculcent eas pedibus suis." > Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in > abyssum?" > -- > Sent from: http://spssx-discussion.1045642.n5.nabble.com/ > > ===================== > To manage your subscription to SPSSX-L, send a message to > LISTSERV@.UGA > (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 -- Sent from: http://spssx-discussion.1045642.n5.nabble.com/ ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (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 |
Free forum by Nabble | Edit this page |