-egen, seq()- could be useful for setting
up a set of identifiers. It is of no use
for generating random counts, however
defined. There is a fair chunk in the
manual entry on -egen- on -seq()-.
I don't know what random counts means in the
abstract here without any specification
of a distribution. Alternatively, if by
random you mean just "arbitrary" or "any
old numbers will do", then why not
use a real dataset instead?
Nick
[email protected]
Joseph Coveney replied to Min Zhang
> I'm not sure how to set up random counts of counties-within-states and
> districts-within-counties using -egen , seq()-, but perhaps
> the following
> might create the data structure that your'e looking for.
>
> (I'm not sure whether school districts are always nested
> within counties.
> In any event, I believe that you can get the actual rosters
> of counties and
> of school districts--Nick's second suggestion--from the U.S.
> Bureau of the
> Census. Check the bureau's website in the SAIPE area:
> "Small Area Income &
> Poverty Estimates--Model-based Estimates for States, Counties & School
> Districts.")
> set obs 50
> generate byte state_id = _n
> generate byte county_id = ceil(50 * uniform()) // 50 is arbitrary
> expand county_id
> bysort state_id: replace county_id = _n
> generate byte school_district_id = ceil(5 * uniform()) // 5 ditto
> expand school_district_id
> bysort state_id county_id: replace school_district_id = _n
*
* 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/