Thank you, Richard.
[Indeed the message above was not intended for Bryan but for the list.
(He was not able to help.)]
I believe that -set tracedepth #- will help expanding the Results to
the necessary depth when running programs!
Sometimes utilizing -program define- seems too much like a black-box:
Simply out of curiosity, could one variably set the tracedepth at the
beginning of each -program define- according to the actual depth that
the routine represents in the hierarchy of programs? Ie. if I am running
a sub-program, two levels below the .do file level (a program within a
program), would Stata know to set the tracedepth as 2+2? Since I
oftentimes add sub-routines to a program I would want to program it
modularly if at all possible.
The second solution, which I had used previously, is indeed helpful when
debugging, but a little tedious. I also tend to use -assert- and
-confirm- in programs.
Thank you and best regards,
Thomas
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Richard
Williams
Sent: Friday, February 17, 2006 4:24 PM
To: [email protected]
Subject: Re: st: Display command in Results Window in Subprogram
At 02:22 PM 2/17/2006, Goerner, Thomas wrote:
>Bryan,
>
>I had a STATA question, and maybe the answer is simple.
>
>When creating multiple programs and subprograms (via program define)
>within the same .do file Stata does not list the actual command that it
>is currently processing in the Results Window. This is as opposed to
>programming without -program define- but "sequentially" (for lack of
>better word). This obviously makes finding bugs more tedious.
Perhaps this was just meant for Bryan(?), but since it made it to the
list...
* There is always -set trace on-. This can overwhelm you with
output, but can be quite useful when you are trying to see what
specifically caused an error
* Within your code, you can put display messages, e.g. -display
"Running sub1"-. Or you might set trace on for a specific part of
code that is problematic. Or, put in commands like -macro
dir-. When I am having trouble, i often find that a piece of code I
expected to be executed isn't. Or, that local macros don't have the
values I think they should have. You can then figure out from there
what the problem is. It may be a simple typo, or it may be a
fundamental error in the program's logic.
-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
FAX: (574)288-4373
HOME: (574)289-5227
EMAIL: [email protected]
WWW (personal): http://www.nd.edu/~rwilliam
WWW (department): http://www.nd.edu/~soc
*
* 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/
_____________________________________________________________
This e-mail and any attachments may be confidential or legally privileged. If you received this message in error or are not the intended recipient, you should destroy the e-mail message and any attachments or copies, and you are prohibited from retaining, distributing, disclosing or using any information contained herein. Please inform us of the erroneous delivery by return e-mail.
Thank you for your cooperation.
_____________________________________________________________
*
* 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/