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

st: confirm

From   Keith Dear <>
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
CRICOS provider #00120C

* For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index