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

Re: st: confirm


From   Philip Ryan <[email protected]>
To   [email protected]
Subject   Re: st: confirm
Date   Tue, 8 Mar 2005 17:16:04 +1030

Keith,

use  -set varabbrev off-

. sysuse auto
(1978 Automobile Data)

. set varabbrev on

. confirm var mak

. set varabbrev off

. confirm var mak
variable mak not found
r(111);


see -help set-

Phil


Quoting Keith Dear <[email protected]>:

> How do I confirm that a variable exists with exactly the name I state, not
> as an abbreviation? If I say -cap confirm var x3- but I have a variable
> x30, then I get _rc==0 even though x3 does not exist.
>
> I'll give the context, in case there's a better way. Here's what I am
> trying to do:
>
> forval i=1/52 {
>    cap confirm var x`i'
>    if _rc!=0 gen x`i'=.
> }
>
> This NEARLY works...
>
> ==========================================================
> Dr Keith B.G. Dear
> Senior Fellow in Biostatistics
> National Centre for Epidemiology and Population Health (NCEPH)


-- 
Philip Ryan
Associate Professor
Department of Public Health
University of Adelaide
5005 South Australia
AUSTRALIA
CRICOS Provider Number 00123M
-----------------------------------------------------------
This email message is intended only for the addressee(s)
and contains information that may be confidential and/or
copyright.  If you are not the intended recipient please
notify the sender by reply email and immediately delete
this email. Use, disclosure or reproduction of this email
by anyone other than the intended recipient(s) is strictly
prohibited. No representation is made that this email or
any attachments are free of viruses. Virus scanning is
recommended and is the responsibility of the recipient.
*
*   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