The intent of the code you give is difficult to understand. It commits
you to generating 20000 new variables, s1-s10000 and u1-u10000, which I
doubt is what you really want.
egen v`i' = rowmean(u`i')
within a loop is just going to put the rowmean of one variable (that
variable, identically) in another variable, which is pointless.
Do start again from the beginning:
1. Explain your data.
2. Explain your problem.
Nick
[email protected]
Carlo Lazzaro
after typing
qui forval i =1/10000 {
qui g double s`i' = Surv_Pos_IFI[`i']*(1-Monthly_Pr_Death_AML_MDS_Prob)
in 1
replace s`i' = s`i'[_n-1]*(1-Monthly_Pr_Death_AML_MDS_Prob) if s`i'==.
qui g double u`i' = s`i'*LYS
}
I would like to obtain a variable where I can store the rowmeans for all
the
u`i'.
I tried unsuccessfully to use egen v`i'=rowmean(u`i'), but this way I
(obviously, I would suppose) get v`i' for each u`i', and this not help
the
achievement of my research purpose.
*
* 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/