[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: How can I check that a variable exists?
The command
. qui cap d xa
Sets _rc to 0 if xa exists, and 111 if not. Thus,
. qui cap d xa
. if _rc == 0 {
. a // this is my action
. }
Kyle Hood
Department of Economics
Yale University
On Mar 12, 2009, at 3:16 PM, "Benjamin Villena Roldan" <[email protected]
> wrote:
Dear statalist,
This may sound like a trivial question, but I unsuccessfully looked
for an
answer so far.
I need to perform certain action A if there is a variable XA
defined in
the dta file, and an action B if there is a variable XB in the dta
file. How
can I do so? Any ideas?
Thanks
Benjamin
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/