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

st: Re: how to split numeric variable


From   "Marcela Perticara" <[email protected]>
To   <[email protected]>
Subject   st: Re: how to split numeric variable
Date   Wed, 24 Sep 2003 18:40:17 -0400

I don�t know if there is an specific command for this, but one way would be
to

gen statecode=full_id-int(full_id/100)*100

where full_id is the original variable. I guess it should work as long as
your state code is always in the last two digit of
your original variable.

Marcela

--------------------------------------------------------------------------
Profesor Asistente, Universidad Alberto Hurtado
Professorial Lecturer, Georgetown University
Erasmo Escala 1835, Santiago (Chile)
Phone: 692-0267
Fax: 692-0303
http://www.ilades.cl/economia/index.html
----- Original Message -----
From: "Wade T Roberts" <[email protected]>
To: <[email protected]>
Sent: Wednesday, September 24, 2003 6:14 PM
Subject: st: how to split numeric variable


> Hi, I was hoping someone might be able to shed some light on this issue.
>
> I have a single numeric variable that identifies the city/county/state for
> each case, where the first three digits represent the city, the next two
> the county, and the final two represent the state.
>
> Examples:
>
>  223406
> 1453209
> 2785845
> etc...
>
> I'm only interested in identifying cases by state at the moment.  How do I
> go about singling out this part of the data, or creating a new identifying
> state variable?
>
> Thanks for any help.
>
> Wade
> *
> *   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