or -inrange()-, as you say.
Nick
n.j.cox@durham.ac.uk
> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu
> [mailto:owner-statalist@hsphsun2.harvard.edu]On Behalf Of Nick Cox
> Sent: 24 February 2004 17:21
> To: statalist@hsphsun2.harvard.edu
> Subject: st: RE: generating a variable as a subset of a numeric one
>
>
> The state is given by
>
> gen State = floor(Region/1000)
>
> The municipality through
>
> gen Municipality = mod(Region,1000)
>
> I'm not sure that you do want dummies,
> but they are easily obtained through
> -tabulate-.
>
> Nick
> n.j.cox@durham.ac.uk
>
> R.E. De Hoyos
>
> > I have a 4 or 5-digits numeric variable (format: int)
> > containing information
> > on state (first 1 or 2 digits) and municipality (remaining
> 3 digits).
> >
> > Region
> > 1001
> > 1002
> >
> >
> >
> > 32001
> > 32002
> >
> >
> >
> >
> > I want to create a new dummy variable (North) that takes the
> > value of one if
> > the state belongs to certain category. I can:
> >
> > gen North=0
> > replace North = 1 if Region >1000 | Region < 2000
> >
> > But I will have to this for each state belonging to
> category North. I
> > thought of the -inlist- command, however first I have to
> > create a data set
> > like the following:
> >
> > Region State Municipality
> > 1001 1 1
> > 1002 1 2
> >
> >
> >
> > 32001 32 1
> > 32002 32 2
*
* 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/