Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: AW: AW: Problems adding large numbers


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: AW: AW: Problems adding large numbers
Date   Wed, 28 Oct 2009 13:03:14 +0100

<> 



Note Nick`s SJ article on this point:
http://www.stata-journal.com/sjpdf.html?articlenum=dm0022,
in particular the last paragraphs...



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Martin Weiss
Gesendet: Mittwoch, 28. Oktober 2009 12:45
An: [email protected]
Betreff: st: AW: Problems adding large numbers 


<> 



*************
clear*
set obs 2
 
gen double HHID=16817000  

gen PERNUM=4
replace PERNUM= 5 in 2

gen double x=HHID+PERNUM

list, noo
*************



HTH
Martin

-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Shruti Kapoor
Gesendet: Mittwoch, 28. Oktober 2009 06:54
An: [email protected]
Betreff: st: Problems adding large numbers 

Hi All,

I need some help, i have a huge individual level dataset. I am trying to
generate a new variable x which is the sum of my household id(HHID) and
person number in each household (PERNUM) for some condition if it is true.

The problem i am facing is that at very large values of HHID lets say
16817000, if the PERNUM is 4 and 5 if should generate variable x = 16817004
and 16817005. What stata is doing is rounding off the numbers so that i am
getting the same values for both PERNUM 4 and 5. This is a problem because
it is no longer creating a unique value of X which i need.

I string to convert the two variables into string and then creating x = HHID
+ PERNUM, but now i am getting answers like 1.68e10+05. How can i resolve
this issue such that it creates a unique value for each individual in the
household and x stays numeric?


Any help would be appreciated.
Thank You,
Shruti



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



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index