Re: Re: st: How to deal with the accruacy of storage type?

 From [email protected] To statalist<[email protected]> Subject Re: Re: st: How to deal with the accruacy of storage type? Date Tue, 29 Sep 2009 14:24:54 +0800

```Jeph and Martin,
thank you very much for your help.
Both methods work well.

Best regards,
Rose.

----- Original Message -----
From: Jeph Herrin <[email protected]>
To: [email protected]
Subject: Re: st: How to deal with the accruacy of storage type?
Date: 2009-9-29 02:35:06

count if abs(x-y)<0.0001

where 0.0001 indicates the precision.

hth,
Jeph

[email protected] wrote:
> I encountered a problem on the accuracy of storage type.
>
> For example, I typed the following in the stata,
>
>
> clear
> input x y
> .46520616 .4652062
> .02347426 .0234743
> .01774185 .0177418
> .04014428 .0401443
> .24818808 .2481881
> .41385191 .4138519
> .27035237 .2703524
> .03764375 .0376438
> .22899382 .2289938
> .08620364 .0862036
> end
> l
> count if x==y
>
>
> The result of "count if x==y" is 0. However, in my actual matter, this situation should be treated as equal between x and y if the # digits (such as four or five) after decimal are the same.
>
> What is the right command to express the above meaning?
>
> Thank you a lot for any help.
>
>
> Best regards,
>
> Rose.
>
>
>
> *
> * 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/

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