| From | David Kantor <[email protected]> |
| To | [email protected] |
| Subject | Re: st:How to do analysis if the same variable exists in one datasetand is missing or contains no observation in another database? |
| Date | Tue, 05 Aug 2003 18:42:54 -0400 |
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.
David Kantor Institute for Policy Studies Johns Hopkins University [email protected] 410-516-5404 * * 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–2025 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |