Dear stata users,
I have the same survey conducted in several developing countries.
The databases contain almost the same variables (most of the time
coded the same way, but differently sometimes).
In each database, I want to tell stata to check for a variable, and if it does
exist or does
contain observations, to perform some task.
I coded for example:
foreach x of varlist v* {
capture confirm existence (`x')
if _rc!=0 {
sum `x'
recode `x' 1=1 2/3=2 4/*=3
}
else {
display "`x' does not exist or may contain no observation"
}
But this does not seem to work. I am using stata 8.
How to do if the codification for the same variable is different across
databases?
Many thanks.