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
James Sams <[email protected]>
To
[email protected]
Subject
Re: st: How to convert number format
Date
Thu, 3 Nov 2011 22:52:40 -0500
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
> Thanks
> Anwar
>
>
> *
> * 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/