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: variable format


From   "Andreas Drichoutis" <[email protected]>
To   <[email protected]>
Subject   RE: st: variable format
Date   Thu, 10 Mar 2011 21:25:03 +0200

My concern is the actual value and neither the round function works nor
changing the format to  %3.2f  . 

Any other ideas?

Andreas


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Joerg Luedicke
Sent: Thursday, March 10, 2011 9:20 PM
To: [email protected]
Subject: Re: st: variable format

On Thu, Mar 10, 2011 at 1:53 PM, Joerg Luedicke
<[email protected]> wrote:
> On Thu, Mar 10, 2011 at 1:27 PM, Andreas Drichoutis <[email protected]>
wrote:
>> Dear all,
>>
>> Some variables in my dataset are stored as float %8.0g . I need to have
>> exactly 2 decimals for these variables, however Stata formats these with
>> more decimals e.g., it stores the value of 8.77 as 8.7700005.
>>
>> How do I convert variables to 2 decimals only.
>
> http://lmgtfy.com/?q=stata+variable+format
>
> in your case it could be something like
>
> format  %3.2f  yourvariable
>
> if you numbers have no more than 3 digits
>
> J.
>

...might need to add that if your concern is not the format but the
actual value, you can round them using the round function together
with generate or replace (-help round-). So if you wanted to replace
your data you could do (if x is your variable):

replace x =round(x, .01)


J.

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