Statalist


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

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


From   Ermal Hitaj <[email protected]>
To   [email protected]
Subject   Re: st: RE: Re: distance data missing values
Date   Fri, 17 Oct 2008 07:39:11 -0700 (PDT)

Nick, thanks a lot,

What you suggested worked perfectly.
Also thanks everybody for taking the time to answer.

E.


--- On Fri, 10/17/08, Nick Cox <[email protected]> wrote:

> From: Nick Cox <[email protected]>
> Subject: st: RE: Re: distance data missing values
> To: [email protected]
> Date: Friday, October 17, 2008, 7:29 AM
> 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/

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
*
*   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