Statalist The Stata Listserver

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

st: RE: Weights vs subscripts

From   "Alex Ogan" <>
To   <>
Subject   st: RE: Weights vs subscripts
Date   Tue, 3 Oct 2006 16:23:31 -0400

Somebody more knowledgeable will probably explain exactly why you can't
use subscripts on the left side like that.

But I can suggest a workaround:

replace y=y[`i'-1] +z[`i'] if _n==`i'
-----Original Message-----
[] On Behalf Of Fan, Shihe
Sent: Tuesday, October 03, 2006 3:57 PM
Subject: st: Weights vs subscripts


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
Office of the MOH
Public Health Division
Suite 300, 10216 - 124 Street
Edmonton AB T5N 4A3		
Phone:(780) 413-7742
Fax: 	(780) 413-7950

*   For searches and help try:

This message is intended solely for the designated recipient(s). It may contain confidential or proprietary information and may be subject to confidentiality protections. If you are not a designated recipient, you may not review, copy, or distribute this message. If you receive this in error, please notify the sender by reply e-mail and delete this message. 

Arrowstreet Capital, L.P. is an Equal Opportunity Employer. 

*   For searches and help try:

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