[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: Appending files when variables differ in their types
This is a relatively simple question. I am appending data from the same survey
for different years. The problem is that some variables appear as strings in
some datasets and as bytes/numbers in others. Perhaps this is due from the
translation from dbf to dta with stattransfer in my specific case, and may be
due to the presence of typos, eg: ` instead of 1, etc.. When appending, only the
original data is used, the new data is lost.
The following two mock datasets illustrate the situation:
When appending the two (for instance append using 2.dta) Stata warns you about
(note: var1 is str1 in using data but will be byte now)
and the result is:
So far I've managed with a set of destring, replace force on each separate file.
But when working with a large number of files and variables, it may become
cumbersome. What I wanted to know is if there is a way to tell Stata to append
every variable as the most general format, that is, str*, when there is a
problem like this.
Thanks in advance for your wisdom!
* For searches and help try: