Hello,
A couple folks on our team have been stumped by this one. We're working in Stata 16.1. I stripped the issue down to a little bit of test code that I'm hoping somebody can pick apart. Basically, when `i'*10000 is commented out we get output that we'd expect (630,1230,631,1231, ...), but when that piece is included it skips the odd values (19610630,19621230,19610632,19621232, 19610632, 19621232,...). It feel like we're missing something really obvious, but I'm not sure what it could be. I tried floor(`i'*10000), but same result.
We don't need a workaround. This is easy to do in a different way. But this is a concerning issue to not be able to resolve.
Thanks!
A couple folks on our team have been stumped by this one. We're working in Stata 16.1. I stripped the issue down to a little bit of test code that I'm hoping somebody can pick apart. Basically, when `i'*10000 is commented out we get output that we'd expect (630,1230,631,1231, ...), but when that piece is included it skips the odd values (19610630,19621230,19610632,19621232, 19610632, 19621232,...). It feel like we're missing something really obvious, but I'm not sure what it could be. I tried floor(`i'*10000), but same result.
We don't need a workaround. This is easy to do in a different way. But this is a concerning issue to not be able to resolve.
Thanks!
Code:
clear set seed 1000 set obs 63 gen year = 1960 +_n gen month = runiformint(1,12) gen cohort = . format cohort %9.0f forval y = 0/9 { forvalues i = 1960/2023 { qui replace cohort = `i'*10000 + 63`y' if inrange(month,1,6) & year==`i' qui replace cohort = `i'*10000 + 123`y' if inrange(month,7,12) & year==`i' } di cohort[1] di cohort[2] qui replace cohort = . }
Comment