Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | R Zhang <r05zhang@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | st: The accuracy of the float data type |
Date | Fri, 24 Jan 2014 10:53:13 -0500 |
Dear Statalist, my data structure is as follows firmID segmentID sales year 1001 1 25.395 1990 1001 1 32.007 1991 ............ a firm can operate in multiple segments as identified by segmentID . I wanted to identify the largest segment by sales,so I used bysort firmID year : egen maxsale=max(sales) then I did gen PriSIC=0 replace PriSIC=1 if sales=maxsale I got firmID segmentID sales year maxsale prisic 1001 1 25.395 1990 25.395 0 1001 1 32.007 1991 32.007 0 I could not figure out why prisic is 0, so I compute the diffderence (sales-maxsale), it shows a very small negative number , and the data dictionary shows sales format float %12.0g, and maxsale format float %9.0g what should I do to correct this? thanks!!! Rochelle * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/