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

From |
Anita Sayal <anitasayal@yahoo.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Fw: RE: st: RE: Data aligning |

Date |
Thu, 19 Mar 2009 02:13:41 -0700 (PDT) |

I think you are right..I didnt explain it well. This is purly a data arranging issue, pre-estimation. The second set of Reporter Partner Year to be dropped once Var2 data is aligned with corresponding the Year Report Partener (frist 3 columns)..for example A D 1986 .4 should be aligned with 2nd row 2..and C A 1989 .3 should be in row 6..its a question of how to do this for a large dataset.. Reporter Partner Year Var1 Reporter Partner Year Var2 > A B 1985 10 A D 1986 .4 > A C 1986 12 C A 1989 .3 > A D 1986 14 > B A 1985 15 > B C 1985 18 > C A 1989 20 > > > --- On Wed, 3/18/09, Nick Cox <n.j.cox@durham.ac.uk> > wrote: > > > From: Nick Cox <n.j.cox@durham.ac.uk> > > Subject: RE: st: RE: Data aligning > > To: statalist@hsphsun2.harvard.edu > > Date: Wednesday, March 18, 2009, 3:05 PM > > Tell people more about your precise data structure and > > variable names. > > (You can not have two variables with the same name.) > > > > I think your previous description led Joseph (and no > doubt > > several > > others) to guess that you were talking about two > different > > datasets. > > > > Nick > > n.j.cox@durham.ac.uk > > > > Anita Sayal > > > > I repeated your example..Its works fine doing > manually..but > > how would I > > replicate for a very large data set and when all data > is in > > single file > > > > --- On Wed, 3/18/09, Joseph Coveney > > <jcoveney@bigplanet.com> wrote: > > > > > > > > Would someone Please tell me what commands arto > ae > > used to > > > align the data for > > > Var2 with corresponding Reporter Partner > combination > > in > > > Column 1 and 2 for > > > corresponding years.. trying to do thiis for a > large > > data > > > set..TX > > > > > > > > > Reporter Partner Year Var1 Reporter > Partner Year Var2 > > > A B 1985 10 A D 1986 > .4 > > > A C 1986 12 C A 1989 .3 > > > A D 1986 14 > > > B A 1985 15 > > > B C 1985 18 > > > C A 1989 20 > > > > > > > > > ------------------------------------------------------------------------ > > -------- > > > > > > -merge- is what I think you're looking for. > Try > > the > > > do-file below, and see > > > whether it gives you the kind of data alignment > that > > you > > > want. > > > > > > Joseph Coveney > > > > > > clear * > > > set more off > > > input str1 Reporter str1 Partner int Year byte > Var1 > > > "A" "B" 1985 10 > > > "A" "C" 1986 12 > > > "A" "D" 1986 14 > > > "B" "A" 1985 15 > > > "B" "C" 1985 18 > > > "C" "A" 1989 20 > > > end > > > > > > tempfile tmpfil0 > > > save `tmpfil0' > > > > > > clear > > > input str1 Reporter str1 Partner int Year float > Var2 > > > "A" "D" 1986 .4 > > > "C" "A" 1989 .3 > > > end > > > > > > merge Reporter Partner Year using `tmpfil0', > sort > > > list Reporter Partner Year Var1 Var2, noobs > > sepby(_merge) > > > exit > > > > * > > * 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/ * * 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/

**Follow-Ups**:**Re: Fw: RE: st: RE: Data aligning***From:*Jeph Herrin <junk@spandrel.net>

- Prev by Date:
**Re: st: Bootstrap after xtregar** - Next by Date:
**Re: st: Bootstrap after xtregar** - Previous by thread:
**st: Ado-files for generating spatial effect variables** - Next by thread:
**Re: Fw: RE: st: RE: Data aligning** - Index(es):

© Copyright 1996–2016 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |