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

st: confirm


From   Keith Dear <[email protected]>
To   [email protected]
Subject   st: confirm
Date   Tue, 08 Mar 2005 15:02:47 +1100

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)
The Australian National University
Canberra, ACT 0200, Australia
Tel: 02 612 54865, Fax: 02 612 50740
http://nceph.anu.edu.au/Staff_Students/staff_pages/dear.php
CRICOS provider #00120C

*
* 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