Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | annoporci <annoporci@gmail.com> |
To | "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |
Subject | st: -capture noisily- shorthand |
Date | Mon, 14 Jan 2013 20:27:34 +0800 |
Dear Statalist,I want to systematically use -capture noisily- throughout a do-file with multiple loops (as some fail).
The shortest form for it is -cap n-Not bad. However, I thought it would be neater to have something even shorter, say -cn-. Unfortunately that's an "unrecognized command" (implemented in a future version of Stata maybe?)
I defined a macro to store "capture noisily" and repeatedly use the macro. See the example code below.
I used a "global" macro so that I could use the dollar sign in front of it -- easy to type and remember.
The trick seems to work, but is it an acceptable practice? any pitfalls? many thanks. -- Patrick Toche. /// Different ways of preceding a command with -capture noisily- clear all sysuse auto capture noisily regress price mpg rep78 cap n reg price mpg rep78 cap n reg price mpg rep79 global cn "capture noisily" $cn reg price mpg rep78 $cn reg price mpg rep79 regress price mpg rep78 * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/