|
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: -collapse- and -merge-
I am regularly puzzled by a particular feature of -merge-, namely to
match missing observations with each other. Here is an example:
sysuse auto, clear
sort price
keep in 1/15
replace foreign=. in 1/5
preserve
collapse (mean) PRICE=price, by(foreign)
sort foreign
list
tempfile m
save `m'
restore
sort foreign
merge foreign using `m'
list foreign PRICE
I can avoid this problem in various ways (a "drop if foreign==." after
the -collapse- would be one option). I also understand that Stata reads
missing values as very large numbers (i.e.: all nonmissing numbers < . <
.a < .b < ... < .z). I do not understand, however, why it matches
missing values with each other. Moreover, the same behavior persists
when I specify the -merge- option "uniqusing".
Let me add that this behavior does not seem as strange in the example
above. However, I usually -merge- data from totally different
data-sources. There is no logical pattern to the missing values, and no
reason to match them.
Am I missing something? Clarifications are appreciated.
Thanks,
Philipp
*
* 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/