Oops ;-(

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Oops ;-(

David Marso
Administrator
DEFINE !FUBAR().
FUBAR
!ENDDEFINE.

DEFINE !oops ()
ECHO !QUOTE(!CONCAT('Ohmy',!EVAL(!FUBAR))).
!ENDDEFINE .
!oops.
Well, I guess there is always !SUBSTR !
Who thought it to be a good idea to add a space to the beginning of the return of !EVAL?
Looks like a deliberate attempt to undermine the usefulness of Macros!
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?"
Reply | Threaded
Open this post in threaded view
|

Re: Oops ;-(

Jon K Peck
Oh, come on Marso.

DEFINE !FUBAR() FUBAR
!ENDDEFINE.

DEFINE !oops ()
ECHO !QUOTE(!CONCAT('Ohmy',!EVAL(!FUBAR))).
!ENDDEFINE .
!oops.


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        David Marso <[hidden email]>
To:        [hidden email]
Date:        11/26/2014 07:40 AM
Subject:        [SPSSX-L] Oops ;-(
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




DEFINE !FUBAR().
FUBAR
!ENDDEFINE.

DEFINE !oops ()
ECHO !QUOTE(!CONCAT('Ohmy',!EVAL(!FUBAR))).
!ENDDEFINE .
!oops.
Well, I guess there is always !SUBSTR !
Who thought it to be a good idea to add a space to the beginning of the
return of !EVAL?
Looks like a deliberate attempt to undermine the usefulness of Macros!



-----
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?"
--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Oops-tp5728038.html
Sent from the SPSSX Discussion mailing list archive at 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


===================== 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
Reply | Threaded
Open this post in threaded view
|

Re: Oops ;-(

King Douglas

David, Jon,

 

I admire you both for this brief exchange.  I can’t stop chuckling…thanks for the laugh. 

 

Is there a place for SPSS stand-up comedy?

 

King Douglas

 

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Jon K Peck
Sent: Wednesday, November 26, 2014 8:52 AM
To: [hidden email]
Subject: Re: Oops ;-(

 

Oh, come on Marso.

DEFINE !FUBAR() FUBAR
!ENDDEFINE.

DEFINE !oops ()
ECHO !QUOTE(!CONCAT('Ohmy',!EVAL(!FUBAR))).
!ENDDEFINE .
!oops.


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        David Marso <[hidden email]>
To:        [hidden email]
Date:        11/26/2014 07:40 AM
Subject:        [SPSSX-L] Oops ;-(
Sent by:        "SPSSX(r) Discussion" <[hidden email]>





DEFINE !FUBAR().
FUBAR
!ENDDEFINE.

DEFINE !oops ()
ECHO !QUOTE(!CONCAT('Ohmy',!EVAL(!FUBAR))).
!ENDDEFINE .
!oops.
Well, I guess there is always !SUBSTR !
Who thought it to be a good idea to add a space to the beginning of the
return of !EVAL?
Looks like a deliberate attempt to undermine the usefulness of Macros!



-----
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?"
--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Oops-tp5728038.html
Sent from the SPSSX Discussion mailing list archive at 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


===================== 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

===================== 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
Reply | Threaded
Open this post in threaded view
|

Re: Oops ;-(

David Marso
Administrator
My Macro is on the rag!
Jon's is menopausal ;-)))
---
King Douglas wrote
David, Jon,

 

I admire you both for this brief exchange.  I can't stop chuckling.thanks
for the laugh.  

 

Is there a place for SPSS stand-up comedy?

 

King Douglas

 

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Jon
K Peck
Sent: Wednesday, November 26, 2014 8:52 AM
To: [hidden email]
Subject: Re: Oops ;-(

 

Oh, come on Marso.

DEFINE !FUBAR() FUBAR
!ENDDEFINE.

DEFINE !oops ()
ECHO !QUOTE(!CONCAT('Ohmy',!EVAL(!FUBAR))).
!ENDDEFINE .
!oops.


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        David Marso <[hidden email]>
To:        [hidden email] 
Date:        11/26/2014 07:40 AM
Subject:        [SPSSX-L] Oops ;-(
Sent by:        "SPSSX(r) Discussion" <[hidden email]>

  _____  




DEFINE !FUBAR().
FUBAR
!ENDDEFINE.

DEFINE !oops ()
ECHO !QUOTE(!CONCAT('Ohmy',!EVAL(!FUBAR))).
!ENDDEFINE .
!oops.
Well, I guess there is always !SUBSTR !
Who thought it to be a good idea to add a space to the beginning of the
return of !EVAL?
Looks like a deliberate attempt to undermine the usefulness of Macros!



-----
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?"
--
View this message in context:
<http://spssx-discussion.1045642.n5.nabble.com/Oops-tp5728038.html>
http://spssx-discussion.1045642.n5.nabble.com/Oops-tp5728038.html
Sent from the SPSSX Discussion mailing list archive at 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


===================== 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


=====================
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?"
Reply | Threaded
Open this post in threaded view
|

Re: Oops ;-(

Kirill Orlov
In reply to this post by David Marso
David,
As I one already wrote on the List, I personally find the behaviour of !EVAL convenient and frequently used it.
!EVAL does the following with its argument (regardless whether it is a macro call or just a string):
- makes all inter-token blanks unit width
- inserts one blank at the beginning
- drops a trailing period
- concatenates lines.
Simply make use of that functionality!


26.11.2014 17:39, David Marso пишет:
DEFINE !FUBAR().
FUBAR
!ENDDEFINE.

DEFINE !oops ()
ECHO !QUOTE(!CONCAT('Ohmy',!EVAL(!FUBAR))).
!ENDDEFINE .
!oops.
Well, I guess there is always !SUBSTR !
Who thought it to be a good idea to add a space to the beginning of the
return of !EVAL?
Looks like a deliberate attempt to undermine the usefulness of Macros!


===================== 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
Reply | Threaded
Open this post in threaded view
|

Re: Oops ;-(

Jon K Peck
!eval does not insert a leading blank.  That would make it useless for things like generating file names.

define !ext () .sav
!enddefine.

define !fn () !quote(!concat(!unquote("abc"), !eval(!ext)))
!enddefine.
echo !fn.


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        Kirill Orlov <[hidden email]>
To:        [hidden email]
Date:        11/26/2014 10:43 AM
Subject:        Re: [SPSSX-L] Oops ;-(
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




David,
As I one already wrote on the List, I personally find the behaviour of !EVAL convenient and frequently used it.
!EVAL does the following with its argument (regardless whether it is a macro call or just a string):
- makes all inter-token blanks unit width
- inserts one blank at the beginning
- drops a trailing period
- concatenates lines.
Simply make use of that functionality!


26.11.2014 17:39, David Marso пишет:
DEFINE !FUBAR().
FUBAR
!ENDDEFINE.

DEFINE !oops ()
ECHO !QUOTE(!CONCAT('Ohmy',!EVAL(!FUBAR))).
!ENDDEFINE .
!oops.
Well, I guess there is always !SUBSTR !
Who thought it to be a good idea to add a space to the beginning of the
return of !EVAL?
Looks like a deliberate attempt to undermine the usefulness of Macros!



===================== To manage your subscription to SPSSX-L, send a message to LISTSERV@... (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
===================== 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
Reply | Threaded
Open this post in threaded view
|

Re: Oops ;-(

David Marso
Administrator
In reply to this post by Kirill Orlov
It  introduces a leading space if there is a period on the DEFINE line.
If there is no period no space gets introduced.
I can't see why a period should make the macro go 'on the rag' as it were ;-)

DEFINE !FUBAR0().
FUBAR0
!ENDDEFINE.

DEFINE !FUBAR1()
FUBAR1
!ENDDEFINE.

DEFINE !oops ().
ECHO !QUOTE(!CONCAT('Oh my',!EVAL(!FUBAR0))).
ECHO !QUOTE(!CONCAT('Oh my',!EVAL(!FUBAR1))).
!ENDDEFINE .
!oops.
---
 424  0 M>  ECHO 'Oh my FUBAR0'.
Oh my FUBAR0
 425  0 M>  ECHO 'Oh myFUBAR1'
Oh myFUBAR1


Kirill Orlov wrote
David,
As I one already wrote on the List, I personally find the behaviour of
!EVAL convenient and frequently used it.
!EVAL does the following with its argument (regardless whether it is a
macro call or just a string):
- makes all inter-token blanks unit width
- inserts one blank at the beginning
- drops a trailing period
- concatenates lines.
Simply make use of that functionality!


26.11.2014 17:39, David Marso ?????:
> DEFINE !FUBAR().
> FUBAR
> !ENDDEFINE.
>
> DEFINE !oops ()
> ECHO !QUOTE(!CONCAT('Ohmy',!EVAL(!FUBAR))).
> !ENDDEFINE .
> !oops.
> Well, I guess there is always !SUBSTR !
> Who thought it to be a good idea to add a space to the beginning of the
> return of !EVAL?
> Looks like a deliberate attempt to undermine the usefulness of Macros!
>


=====================
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?"
Reply | Threaded
Open this post in threaded view
|

Re: Oops ;-(

Jon K Peck
You should not normally use a period on the DEFINE line.  Everything after the argument spec becomes part of the body of the macro.
The CSR syntax definition and examples do not use a period there.  Look at the difference in the expansions of the two invocations.

set mprint on.
DEFINE !FUBAR0().
freq jobcat.
!ENDDEFINE.

DEFINE !FUBAR1()
freq jobcat.
!ENDDEFINE.

set  mprint on.
!fubar0.
!fubar1.

Or try
DEFINE !FUBAR0().freq jobcat.
!ENDDEFINE.

DEFINE !FUBAR1()freq jobcat.
!ENDDEFINE.

The period becomes part of the body of the macro.

So, why doesn't this cause an error?  Think back to batch vs interactive syntax.
In batch mode, commands must start in column 1 BUT a + or - in column 1 allows you to indent the command.  Once upon a time you could also use a period in column 1 for that purpose.  Although that has not been documented since at least V15, which is the oldest version I have around, it still works.

As evidence, here's a fragment of a very old syntax file that I found in my dustbin.

loop           # = 1 to 20000.
.  compute        v1 = max(0,trunc(1000+norm(50))).
.  loop           ## = 2 to 500.
.     compute        v(##) = max(0,trunc(.95*v(##-1)+50+norm(50))).
.  end loop.
.  loop           ## = 1 to 500.
.     do if          unif(1) > .995.
.        compute        v(##) = -1.
.     end if.
.  end loop.
.  end case.
end loop.
end file.


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        David Marso <[hidden email]>
To:        [hidden email]
Date:        11/26/2014 04:19 PM
Subject:        Re: [SPSSX-L] Oops ;-(
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




It  introduces a leading space if there is a period on the DEFINE line.
If there is no period no space gets introduced.
I can't see why a period should make the macro go 'on the rag' as it were
;-)

DEFINE !FUBAR0().
FUBAR0
!ENDDEFINE.

DEFINE !FUBAR1()
FUBAR1
!ENDDEFINE.

DEFINE !oops ().
ECHO !QUOTE(!CONCAT('Oh my',!EVAL(!FUBAR0))).
ECHO !QUOTE(!CONCAT('Oh my',!EVAL(!FUBAR1))).
!ENDDEFINE .
!oops.
---
424  0 M>  ECHO 'Oh my FUBAR0'.
Oh my FUBAR0
425  0 M>  ECHO 'Oh myFUBAR1'
Oh myFUBAR1



Kirill Orlov wrote
> David,
> As I one already wrote on the List, I personally find the behaviour of
> !EVAL convenient and frequently used it.
> !EVAL does the following with its argument (regardless whether it is a
> macro call or just a string):
> - makes all inter-token blanks unit width
> - inserts one blank at the beginning
> - drops a trailing period
> - concatenates lines.
> Simply make use of that functionality!
>
>
> 26.11.2014 17:39, David Marso ?????:
>> DEFINE !FUBAR().
>> FUBAR
>> !ENDDEFINE.
>>
>> DEFINE !oops ()
>> ECHO !QUOTE(!CONCAT('Ohmy',!EVAL(!FUBAR))).
>> !ENDDEFINE .
>> !oops.
>> Well, I guess there is always !SUBSTR !
>> Who thought it to be a good idea to add a space to the beginning of the
>> return of !EVAL?
>> Looks like a deliberate attempt to undermine the usefulness of Macros!
>>
>
>
> =====================
> 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?"
--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Oops-tp5728038p5728056.html
Sent from the SPSSX Discussion mailing list archive at 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


===================== 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
Reply | Threaded
Open this post in threaded view
|

Re: Oops ;-(

Robert Walker
In reply to this post by David Marso
Alternatively, assigning to a macro variable eliminates the leading space:

DEFINE !FUBAR().
FUBAR
!ENDDEFINE.

DEFINE !oops ()
!LET !X=!EVAL(FUBAR)
ECHO !QUOTE(!CONCAT('Ohmy',!EVAL(!X))).
!ENDDEFINE .
!oops.

Regards,

Bob Walker
Surveys & Forecasts, LLC


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of David Marso
Sent: Wednesday, November 26, 2014 9:39 AM
To: [hidden email]
Subject: Oops ;-(

DEFINE !FUBAR().
FUBAR
!ENDDEFINE.

DEFINE !oops ()
ECHO !QUOTE(!CONCAT('Ohmy',!EVAL(!FUBAR))).
!ENDDEFINE .
!oops.
Well, I guess there is always !SUBSTR !
Who thought it to be a good idea to add a space to the beginning of the return of !EVAL?
Looks like a deliberate attempt to undermine the usefulness of Macros!



-----
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?"
--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Oops-tp5728038.html
Sent from the SPSSX Discussion mailing list archive at 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

=====================
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