Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: -joinby- problem


From   "Michael Blasnik" <[email protected]>
To   <[email protected]>
Subject   st: Re: -joinby- problem
Date   Fri, 9 Apr 2004 08:27:33 -0400

This seems like a completely straightforward problem for merge:

merge ward year using labels

I'm not sure why you would even look at -joinby- for this type of problem
(and you certainly wouldn't want to list pano in the varlist since that is
what you are tring to lookup)

Michael Blasnik
[email protected]

----- Original Message ----- 
From: "Clive Nicholas" <[email protected]>
To: <[email protected]>
Sent: Friday, April 09, 2004 6:10 AM
Subject: st: -joinby- problem


> All,
>
> I'm trying to join this data of wards
>
>      +--------------------------------------------+
>      | pano   year   district        ward   votes |
>      |--------------------------------------------|
> 680. |    .     78    enfield       ARNOS    1394 |
> 681. |    .     82    enfield       ARNOS     493 |
> 682. |    .     82    enfield       ARNOS     536 |
> 683. |    .     86    enfield       ARNOS     545 |
> 684. |    .     86    enfield       ARNOS     534 |
>      |--------------------------------------------|
> 685. |    .     90    enfield       ARNOS     368 |
> 686. |    .     78    enfield       ARNOS     126 |
> 687. |    .     78    enfield       ARNOS     104 |
> 688. |    .     82   greenwic     ARSENAL     105 |
> 689. |    .     86   greenwic     ARSENAL      77 |
>      |--------------------------------------------|
> 690. |    .     78   greenwic     ARSENAL     555 |
> 691. |    .     82   greenwic     ARSENAL     641 |
<snip>
> 709. |    .     86    croydon   ASHBURTON     860 |
>      |--------------------------------------------|
> 710. |    .     90    croydon   ASHBURTON    1157 |
>      +--------------------------------------------+
>
> with this -reshape-d (long) list from another file (labels.dta)
>
>      +-------------------------+
>      | pano   year        ward |
>      |-------------------------|
>  73. |  238     78       ARNOS |
>  74. |  238     82       ARNOS |
<snip>
>  80. |  284     90     ARSENAL |
>  81. |  169     78   ASHBURTON |
>  82. |  169     82   ASHBURTON |
>      |-------------------------|
>  83. |  169     86   ASHBURTON |
>  84. |  169     90   ASHBURTON |
>      +-------------------------+
>
> by each "pano" number. The objective is to insert the correct "pano"
> number into each "ward" entry for analysis by constituency.
>
> I have tried just about everything possible to make it work using
> -joinby-, including (amongst others)
>
> . joinby ward pano year using c:\data\labels.dta, unmatched(both)
>
> Every time I attempt via -joinby-, I get this:
>
>      +--------------------------------------------+
>      | pano   year   district        ward   votes |
>      |--------------------------------------------|
> 775. |    .     86   greenwic     ARSENAL     317 |
> 776. |    .     90   greenwic     ARSENAL     290 |
> 777. |    .     90   greenwic     ARSENAL     162 |
> 778. |    .     90   greenwic     ARSENAL     575 |
> 779. |    .     90   greenwic     ARSENAL      40 |
>      |--------------------------------------------|
> 780. |  169     78          .   ASHBURTON       . |
> 781. |  169     82          .   ASHBURTON       . |
<snip>
>      +--------------------------------------------+
>
> which is clearly not what I want. Is there a way of doing this without
> having to copy and paste the data in _both_ files? Cheers.
>
> CLIVE NICHOLAS        |t: 0(44)191 222 5969
> Politics              |e: [email protected]
> Newcastle University  |http://www.ncl.ac.uk/geps


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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