Statalist


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

st: RE: Re: distance data missing values


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Re: distance data missing values
Date   Fri, 17 Oct 2008 12:29:13 +0100

In that spirit: 

I take that the only issue is filling in gaps for pairs of trading
partners, i.e. the distance between A and B is necessarily the same as
the distance between A and B. 

Then I don't see any need for a file fandango: 

gen first = cond(Exporter < Importer, Exporter, Importer) 
gen second = cond(Exporter < Importer, Importer, Exporter) 
egen pairs = group(first second) 
bysort pairs (distance) : replace distance = distance[1] if
missing(distance) 

Nick 
[email protected] 

Martin Weiss

This question is quite close to: 
http://www.stata.com/statalist/archive/2008-10/msg00578.html
Might want to try your luck there...

Ermal Hitaj

> 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).

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index