Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Filling in missing values in bilateral trade data


From   Jonathan Stoeterau <jonathanstoeterau@gmail.com>
To   statalist <statalist@hsphsun2.harvard.edu>
Subject   st: Filling in missing values in bilateral trade data
Date   Wed, 3 Mar 2010 21:43:20 +0100

Dear Statalist,

i have a big panel of bilateral trade flows in product groups
for a single year (2007) for which i want to use the Heckman
sample selection estimator in a gravity set up.
However, to estimate the first step probit model I would need
zero-trade observations.
Since all zero trade observation are not reported, i used

. egen imp_prod=group( imp_num prod_num )

(where *_num are id-number for partners and categories)
to give make an artificial year variable to be
able to use tsfill to get missing values for all
zero trade flows:

. tsset exp_num imp_prod
. tsfill, full

However, i need to fill the missing values in the imp_num
and prod_num with the correct identifiers.
I found http://www.ats.ucla.edu/stat/stata/faq/fill_down.htm
and tried, for example,

. sort exp_num imp_prod
. bysort exp_num: carryforward imp_num, gen(imp_num2)

But it does not work properly on my data, since there are too
many missing values and it only uses the respective last observation
until the next non-missing observation gives him a new value.

is there any other way of doing this?

Really, I would be really thankful,

Jonathan

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index