I wrote
> The error message arises because
> Stata guesses that you are trying to specify weights
> and weights, specified in [ ], are not allowed on the LHS of
> a -replace- statement. It is also true that subscripts
> specified in [] are not allowed on the LHS of a -replace-
> statement, but then they are not allowed in any Stata statement
> that I can think of.
I should correct and expand on this.
You can use _matrix_ subscripts on the LHS (left-hand side)
of a command like
matrix whatever[1,1] = 234
but I cannot recall an instance in which you can
use subscripts indicating observations on the
LHS of a non-matrix assignment.
When specifying weights it is in fact legal
to write them hard against a variable name;
thus
. su mpg[w=headroom]
is legal. There could be a little discussion
about whether (1) allowing this was a good idea
(2) doing this is good style, but set those
issues aside: this is legal, and it helps to
explain why Stata misreads illegal subscripts
as illegal attempts to assign weights
in a -replace-.
Nick
[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/