[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
RE: st: RE: how to create a HLM dataset
Once again, it is impossible to comment
on code you do not show us.
A simple example of the use of -egen, seq()-:
Let's set up 50 states X 50 counties X 10 districts:
set obs 25000
* we want 500 replicates of each state id:
egen state = seq(), block(500)
* within each state 10 replicates of each county
bysort state: egen county = seq(), block(10)
* within each county, ids 1 up
bysort state county : egen district = seq()
> well. forget about the random counts. I use uniform
> distribution in my case.
> And what I want to do is to know how to use stata to create a
> dataset with
> "nested" structure. I tried to use nested loops to do this.
> however, it failed.
> therefore I want to know how to use egen seq() to set up
> identifiers to achieve this goal.
> > -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?
* For searches and help try: