Statalist


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

st: RE: RE: Re: distance data missing values


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: Re: distance data missing values
Date   Fri, 17 Oct 2008 13:57:00 +0100

A and B ... B and A ... NJC 

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox
Sent: 17 October 2008 12:29
To: statalist@hsphsun2.harvard.edu
Subject: st: RE: Re: distance data missing values

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 
n.j.cox@durham.ac.uk 

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