Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: Individual IDs with non-numeric characters


From   "Lachenbruch, Peter" <Peter.Lachenbruch@oregonstate.edu>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Individual IDs with non-numeric characters
Date   Mon, 2 Feb 2009 15:27:36 -0800

Much better than my idea

Tony

Peter A. Lachenbruch
Department of Public Health
Oregon State University
Corvallis, OR 97330
Phone: 541-737-3832
FAX: 541-737-4001


-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Phil Schumm
Sent: Monday, February 02, 2009 3:25 PM
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: Individual IDs with non-numeric characters

On Feb 2, 2009, at 4:58 PM, Benson Limann wrote:
> The individual IDs in my dataset are in the string format. I  
> currently use -destring- to make them numeric. But, unfortunately,  
> some individual IDs have non-numeric characters. As a result, - 
> destring- with the -force- option deletes all these individuals  
> automatically.
>
> Given that I want to sort all the observations, is it possible to  
> keep these individuals with non-numeric IDs?


It's unclear what you're asking -- if some IDs have non-numeric  
characters that you want to preserve, then you have no choice but to  
leave the variable as a string.  Why would you want to destring your  
ID variable anyway, given the headaches that a long numeric ID can  
cause (if not handled properly)?  If the only reason is to facilitate  
the use of commands that require a numeric identifier (e.g., -xtset-),  
then this is easily addressed, e.g.:

egen panel = group(id)
xtset panel


-- Phil

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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