Statalist


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

Re: st: distance data missing values


From   "Austin Nichols" <austinnichols@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: distance data missing values
Date   Thu, 16 Oct 2008 17:43:13 -0400

Ermal Hitaj <ermalhitaj@yahoo.com>:
Maybe swap names and -joinby- like so:

clear
input Exporter Importer Distance
1          2       1000
2          1          .
end
ren Exporter i
ren Importer e
tempfile other
save `other'
ren e im
ren i e
ren im i
ren Distance d
joinby e i using `other'
g dist=max(Distance,d)
li

On Thu, Oct 16, 2008 at 4:28 PM, Ermal Hitaj <ermalhitaj@yahoo.com> wrote:
> Hi,
>
> I wonder whether somebody could help with the following:
> I have trade distance data in a long form. I have missing values as follows.
>
> Exporter Importer Distance
> A          B       1000km
> B          A          .
>
> I need to substitute the missing values with the distance value from the case where country A is the exporter and B is the importer.
> Obviosly, there's a lot of countries (and a lot of products).
>
> Thanks,
> E.
*
*   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   |   What's new   |   Site index