Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Nick Cox <njcoxstata@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
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 <sams.james@gmail.com> 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 > sams.james@gmail.com > > 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/