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: How to convert number format


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: How to convert number format
Date   Fri, 4 Nov 2011 07:16:15 +0000

Whatever solution you use note that two decimal digits can only be
held approximately in most cases. -search precision- for much more
details of the consequences of using binary representations.

Nick

On Fri, Nov 4, 2011 at 3:52 AM, James Sams <[email protected]> wrote:
> Given the variable is called v2, i think this will do the trick. Only tested
> with positive numbers.
>
> replace v2 = v2/10^(floor(log10(v2))-2) if v2 >= 1000
>
> --
> James Sams
> [email protected]
>
> On Thursday, November 03, 2011, you wrote:
>> HI ,
>>
>> I apologize for the asking this question
>>
>> I have a list of numbers as observations for a variable like
>>
>> 20
>> 43
>> 200
>> 298
>> 888
>> 4619
>> 5311
>> 5312
>> 20210
>> 20218
>>
>> How do I convert the numbers more than 3 digits(> 999) to have decimal
>> after the third digit , i.e., Convert  4619 -->461.9;convert 5311-->531.1;
>> 20210-->201.10;20218-->202.18 and leave the two digit and three digit
>> numbers as they are i.e., leave 20,43,298 etc as they are

*
*   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