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

st: -joinby- problem


From   "Clive Nicholas" <[email protected]>
To   [email protected]
Subject   st: -joinby- problem
Date   Fri, 9 Apr 2004 11:10:04 +0100 (BST)

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 |
692. |    .     86   greenwic     ARSENAL     685 |
693. |    .     90   greenwic     ARSENAL     575 |
694. |    .     78   greenwic     ARSENAL      85 |
     |--------------------------------------------|
695. |    .     90   greenwic     ARSENAL     290 |
696. |    .     82   greenwic     ARSENAL     207 |
697. |    .     86   greenwic     ARSENAL     317 |
698. |    .     90   greenwic     ARSENAL      40 |
699. |    .     90   greenwic     ARSENAL     162 |
     |--------------------------------------------|
700. |    .     78    croydon   ASHBURTON    2038 |
701. |    .     82    croydon   ASHBURTON    1818 |
702. |    .     86    croydon   ASHBURTON    1471 |
703. |    .     90    croydon   ASHBURTON    1640 |
704. |    .     78    croydon   ASHBURTON    1851 |
     |--------------------------------------------|
705. |    .     82    croydon   ASHBURTON    1708 |
706. |    .     86    croydon   ASHBURTON    1338 |
707. |    .     90    croydon   ASHBURTON    1529 |
708. |    .     78    croydon   ASHBURTON     805 |
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 |
 75. |  238     86       ARNOS |
 76. |  238     90       ARNOS |
 77. |  284     78     ARSENAL |
     |-------------------------|
 78. |  284     82     ARSENAL |
 79. |  284     86     ARSENAL |
 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       . |
782. |  169     86          .   ASHBURTON       . |
783. |  169     90          .   ASHBURTON       . |
784. |    .     78    croydon   ASHBURTON    2038 |
     |--------------------------------------------|
785. |    .     78    croydon   ASHBURTON    1851 |
786. |    .     78    croydon   ASHBURTON     230 |
787. |    .     78    croydon   ASHBURTON     206 |
788. |    .     78    croydon   ASHBURTON     805 |
789. |    .     78    croydon   ASHBURTON     770 |
     |--------------------------------------------|
790. |    .     82    croydon   ASHBURTON     617 |
     +--------------------------------------------+

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