It seems to work fine as a do file.
Scott
. sysuse auto,clear
(1978 Automobile Data)
. capture program drop happy
. program define happy
1. version 10
2. syntax varlist
3. tempvar tmpvar0 tmpvar1
4. /* quietly */ foreach var of local varlist {
5. display in smcl as text "Happy"
6. }
7. end
.
. set trace on
.
. happy mpg price
---------------------------------------------------------------------------------------------------------------------------------------
begin happy ---
- version 10
- syntax varlist
- tempvar tmpvar0 tmpvar1
- foreach var of local varlist {
- display in smcl as text "Happy"
Happy
- }
- display in smcl as text "Happy"
Happy
- }
-----------------------------------------------------------------------------------------------------------------------------------------
end happy ---
.
end of do-file
On Sat, Jun 7, 2008 at 4:38 AM, Joseph Coveney <[email protected]> wrote:
> I thought that we can use /* */ to temporarily comment-out code for
> debugging, but I'm obviously doing something wrong here (below). Can
> someone point it out to me?
>
> Joseph Coveney
>
> . program define happy
> 1. version 10
> 2. syntax varlist
> 3. tempvar tmpvar0 tmpvar1
> 4. /* quietly */ foreach var of local varlist {
> 5. display in smcl as text "Happy"
> 6. }
> 7. end
>
> . set trace on
>
> . happy hgt wgt
> --------------------------------------------------------------------------
> begin happy ---
> - version 10
> - syntax varlist
> - tempvar tmpvar0 tmpvar1
> - /* quietly */ foreach var of local varlist {
> unrecognized command: / invalid command name
> ----------------------------------------------------------------------------
> end happy ---
> r(199);
>
*
* 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/