Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Mariano Matias Iberico <matias.iberico@gmail.com> |
To | <statalist@hsphsun2.harvard.edu> |
Subject | st: incorrect results seen when creating new variable by multiplying existing variables |
Date | Tue, 08 Mar 2011 23:17:15 -0500 |
I have a problem when trying to generate a new master variable to identify clusters for an -expand– I use later. When passing into 1000s of observations the newid variable becomes funky. I managed to recreate the problem using a stata dataset: . sysuse nlsw88.dta . keep idcode age grade . replace grade=1 if grade==. . generate newid=. . format %11.0g newid . replace newid=_n*10000+age*100+grade The problem is evident if you look at observation 2236 for example. Newid idcode age grade 22364108 5127 41 7 The grade portion of the newid does not parse with the actual grade variable. When using: . display 2236*10000+41*100+7 The result is fine! This same problem occurs with observations 2238, 2241 and many others. I can't figure out why this is occurring! Regards, Matias Iberico MD/MPH candidate Wright State University BSOM |