Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

RE: st: Re: format


From   Jan S <[email protected]>
To   <[email protected]>
Subject   RE: st: Re: format
Date   Sun, 29 Jul 2012 15:41:31 +0000

You may use the -encode- command: encode x, egen(y). This will yield a unique ID, however in a different format. The IDs, if I recall correctly, start at 1 and go up counting. 

----------------------------------------
> From: [email protected]
> To: [email protected]
> Subject: st: Re: format
> Date: Sun, 29 Jul 2012 21:08:28 +0900
>
> Chiara Mussida wrote:
>
> i have a string variable of 18 lenght. This is my id and i need it
> numerical. I proceeded with destring and i got a numerical variable in
> double format. I tried to get it in the format %18.0f, but i realised
> that stata does not maintain the original number. It approx each
> variable and in this way i cannot get a unique id Per individual. Do
> you know whether it is a problem of wrong format?
>
> --------------------------------------------------------------------------------
>
> It is not a problem of the wrong format. At the command line type:
>
> help data_types
>
> and examine the precision of Stata's numerical data types.
>
> I'm curious as to why you believe that you must store eighteen-character IDs as
> numbers. If you need to obtain a numerical ID for use of one of Stata's -xt-
> commands, then you can use -encode-.
>
> Joseph Coveney
>
>
> *
> * 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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index