Hi,
Could any one explain to me why it is OK to write the code in the
following way
gen y=0
foreach i of varlist x {
replace y=y[`i'-1]+ z[`i']
}
but not OK in this way
replace y[`i']=y[`i'-1] +z[`i']
the program always treat the [`i'] on the left side as weights, instead
of subscripts
Thank you,
Shihe Fan
Epidemiologist
Office of the MOH
Public Health Division
Suite 300, 10216 - 124 Street
Edmonton AB T5N 4A3
Phone:(780) 413-7742
Fax: (780) 413-7950
[email protected]
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/