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

Re: st: Collapsing ward-level electoral data


From   Doug Owens <[email protected]>
To   [email protected]
Subject   Re: st: Collapsing ward-level electoral data
Date   Mon, 22 Mar 2004 22:09:00 -0600

collapse (mean) turn (sum) votes, by(city dist const)

At 02:51 AM 3/23/2004 +0000, you wrote:
All,

I've obtained some extremely large datasets that contain the following
structure:

. list id year cty dist turn const vote in 26640/26660

       +-------------------------------------------------------------+
       |       id   year        cty       dist   turn   const   vote |
       |-------------------------------------------------------------|
26640. | 87.51051     87   tyne and   sunderla   29.4     555    311 |
26641. | 87.51051     87   tyne and   sunderla   29.4     555    170 |
26642. | 87.51051     87   tyne and   sunderla   31.6     322   2119 |
26643. | 87.51051     87   tyne and   sunderla   31.6     322    738 |
26644. | 87.51051     87   tyne and   sunderla   31.6     322    570 |
       |-------------------------------------------------------------|
26645. | 87.51051     87   tyne and   sunderla   32.5     322   2243 |
26646. | 87.51051     87   tyne and   sunderla   32.5     322    433 |
26647. | 87.51051     87   tyne and   sunderla   32.5     322    252 |
26648. | 87.51051     87   tyne and   sunderla   33.5     322   2092 |
26649. | 87.51051     87   tyne and   sunderla   33.5     322   1150 |
       |-------------------------------------------------------------|
26650. | 87.51051     87   tyne and   sunderla   33.5     322   1057 |
26651. | 87.51051     87   tyne and   sunderla   32.8     322   1864 |
26652. | 87.51051     87   tyne and   sunderla   32.8     322    797 |
26653. | 87.51051     87   tyne and   sunderla   32.8     322    543 |
26654. |  87.5201     87   west mid   birmingh   44.5      60   3644 |
       |-------------------------------------------------------------|
26655. |  87.5201     87   west mid   birmingh   44.5      60   3352 |
26656. |  87.5201     87   west mid   birmingh   44.5      60   2374 |
26657. |  87.5201     87   west mid   birmingh   34.3      58   4517 |
26658. |  87.5201     87   west mid   birmingh   34.3      58    871 |
26659. |  87.5201     87   west mid   birmingh   34.3      58    774 |
       |-------------------------------------------------------------|
26660. |  87.5201     87   west mid   birmingh   34.3      58    219 |
       +-------------------------------------------------------------+

Naturally, this is a snapshot not just of cases, but also of variables.
Each case represents the voting record of a candidate standing in a
council ward ("ward" is not shown here).

What I want to do is 'collapse' this ward-level data into constituencies
("const"). As you can see, each constituency has its own number. Trouble
is, how can I achieve this whilst summing the votes, averaging the turnout
("turn"), keeping the same "year", "city" and "dist" and so forth?
I suspect this might be too tricky even for the list.





CLIVE NICHOLAS        |t: 0(44)191 222 5969
Politics Building     |e: [email protected]
School of Geography,  |f: 0(44)870 126 2421
 Politics & Sociology |
University of         |
 Newcastle-upon-Tyne  |
Newcastle-upon-Tyne   |
NE1 7RU               |
United Kingdom        |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/
*
*   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