Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: problem with delimit ; and // comenting


From   "FEdMerchant" <[email protected]>
To   <[email protected]>
Subject   st: RE: problem with delimit ; and // comenting
Date   Sat, 10 Jul 2004 10:21:22 -0700

Looks like you've found a bug. Though it's not in -help comments-, if
the end-of-line character has been set to ";", then a following comment
line beginning with  //  needs to be preceded by a space. Example
programs follow. This message is also being sent to Stata.

..Frank de Libero
[email protected]


* If end-of-line character is ";",  this -do- fails at first // which
* is not preceded by a space. Error msg is:
* unrecognized command:  / invalid command name
* r(199);

capture program drop misha1        // This -do- does not work
program define misha1
version 8.2

#delimit ;

// this comment works, delimiter is set to;
di "Works fine";
 // Second comment screws up something.;
di in red "Why do I get an error here ?";

#delimit cr

end
misha1
-------------------------------------------------


* However, preceding // with a space works if end-of-line character is ;

capture program drop misha1        // This -do- works
program define misha1
version 8.2

#delimit ;

 // this comment works, delimiter is set to;
di "Works fine";
 // Second comment screws up something.;
di in red "Why do I get an error here ?";

#delimit cr

end
misha1
-------------------------------------------------

* And a preceding space is not necessary if end-of-line character is cr

capture program drop misha2        // This -do- works
program define misha2
version 8.2

// this comment works, delimiter is set to
di "Works fine"
// Second comment screws up something.
di in red "Why do I get an error here ?"

end
misha2
-------------------------------------------------

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of
[email protected]
Sent: Friday, July 09, 2004 4:29 PM
To: [email protected]
Subject: st: problem with delimit ; and // comenting

I got an error running a very simple program, that sets delimit to ; 
and then has some commentaries with it.
I can't figure out the reason for it, but I suspect that it happens on
the second occurence of the // comment. 

The program is very simple
--------------------------------------
#delim ; 
// this comment works, delimiter is set to; 
di "Works fine";
// Second comment screwes up something. ;
   di in red "Why do I get an error here ?"; 
-----------------------------------------
Yet, I get an error on the last line, and never get it excuted.
I wonder whats going on here ?

Initially I tried to see if I need to put semicolon on the end of *, /*
*/ or // comments, and would appericated any answer on that matter as
well. Thanks!
Misha Bontch-Osmolovski
World Bank.

Stata Results output:
----------------------------------------------
. #delim ; 
delimiter now ;
. // this comment works, delimiter is set to; 
> di "Works fine";
Works fine
r; t=0.00 19:16:08

. // Second comment screwes up something. ;
unrecognized command:  / invalid command name
r(199); t=0.00 19:16:08

end of do-file
r(199); t=0.00 19:16:08
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index