Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Weights vs subscripts


From   "Fan, Shihe" <[email protected]>
To   <[email protected]>
Subject   st: Weights vs subscripts
Date   Tue, 3 Oct 2006 13:57:29 -0600

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/



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