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

st: Help Creating a Count Variable

From   <[email protected]>
To   <[email protected]>
Subject   st: Help Creating a Count Variable
Date   Thu, 14 Jul 2005 00:48:44 -0000

Hi all, I have a coding question.  I have individual-level data (candidates)
nested in aggregate-level units (electoral districts).  I am attempting to
create a variable that indicates that number of different parties (not the
number of candidates, but the number of political parties present) present in
an electoral district.

For example in District A: I have five candidates from 3 different parties.

I need advice on how to generate this variable.  I have tried the egen var=
count() method after sorting on the district.  This does not work. Any advice.

Thanks Gina Branton

*   For searches and help try:

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