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 (June 2005)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 10 Jun 2005 08:54:44 +0200
Reply-To:     Spousta Jan <JSpousta@CSAS.CZ>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Spousta Jan <JSpousta@CSAS.CZ>
Subject:      Re: Debugging of programs
Comments: To:
Content-Type: text/plain; charset="ISO-8859-1"

Hi Georg,

Some more comments:

1) The "strange" behavior of ECHO in the standard DO IF - END IF command has its cause. DO IF is evaluated for _every_ case in the data separately - even if the logical condition is false for all cases. But ECHO is displayed only _one times_. Therefore it is not easy to imagine, how it should be implemented more logically.

2) The disadvantage of the @echo macro is that it must be always defined, otherwise the code will produce error messages...

3) The method enables you to issue user defined messages. Open a new instance of SPSS and try to run this:

@echo Über allen Gipfeln ist Ruh' .

DEFINE @echo (!pos=!def("*********** OK ***********") !cmd). !if (!eval(@debug) !eq 1) !then . echo !quote(!1). !ifend !ENDDEFINE .

@echo In allen Wipfeln spürest Du . DEFINE @debug () 1 !ENDDEFINE . @echo Kaum einen Hauch;. DEFINE @debug () Maul halten !ENDDEFINE . @echo Die Vögelein schweigen im Walde . DEFINE @debug () 1 !ENDDEFINE . @echo Warte nur, balde ruhest Du auch. . @echo.



-----Original Message----- From: Spousta Jan Sent: Thursday, June 09, 2005 5:13 PM To: '' Cc: SPSSX-L@LISTSERV.UGA.EDU Subject: Re: Debugging of programs

Hi Georg,

It was not a solution, it was a demonstration of the problem only. The soulution would be to define two macros:

DEFINE @echo (). !if (!eval(@debug) !eq 1) !then . echo 'Here am I !'. !ifend !ENDDEFINE .

DEFINE @debug () 1 !ENDDEFINE . @echo . DEFINE @debug () 0 !ENDDEFINE . @echo .

The macro @echo says 'Here am I !' only if the macro @debug is on (=defined as 1).



-----Original Message----- From: [] Sent: Thursday, June 09, 2005 5:04 PM To: Spousta Jan Cc: SPSSX-L@LISTSERV.UGA.EDU Subject: ***SPAM*** AW: Re: Debugging of programs

Hi Jan,

thanks for your reply. It try your proposed solution, but unfortunately the outcome was the same as without "-".

Any ideas why this does not work on my machine?


Georg Maubach e-Mail

-----Ursprüngliche Nachricht----- Von: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] Im Auftrag von Spousta Jan Gesendet: Donnerstag, 9. Juni 2005 17:00 An: SPSSX-L@LISTSERV.UGA.EDU Betreff: Re: Debugging of programs

Hi Georg,

Your main problem is that the DO IF command does _not_ prevent the ECHO command to execute. It is devoted to the transformation commands (COMPUTE, RECODE etc.) only.


do if (1 = 0). - ECHO 'Eppur si muove' . end if.

Strange, I agree. Keep smile.



-----Original Message----- From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU]On Behalf Of Georg Maubach Sent: Thursday, June 09, 2005 4:48 PM To: SPSSX-L@LISTSERV.UGA.EDU Subject: Debugging of programs

Hi all,

we would like to use some sort of debugging mode in our programs. We defined a macro

DEFINE @debug () 1 !ENDDEFINE .

and use it in a DO IF command. But this does not work. What are we doing wrong?

Example: DEFINE @debug () 1 !ENDDEFINE /* debug switched on */ . DO IF (@debug = 1) . ECHO 'Debugging Modus is on' . ECHO 'Any debugging commands' . END IF .

DEFINE @debug () 0 !ENDDEFINE /* debug switched off */ . DO IF (@debug = 1) . ECHO 'Debugging Modus is on' . ECHO 'Any debugging commands' . END IF .

Output: Debugging Modus is on Any debugging commands

Debugging Modus is on Any debugging commands

In the latter case the text "Debugging Modus is on" and "Any debugging comands" should not appear. How could we change it so that the debugging commands are not run if the macro @debug is set to 0 with the command DEFINE @debug () 0 !ENDDEFINE?

Best regards

Georg Maubach Market Analyst Deutsche Post World Net Business Consulting GmbH Market Research Service Center

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