Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: assignment by indexing


From   Allan Reese <[email protected]>
To   Stata distribution list <[email protected]>
Subject   RE: st: assignment by indexing
Date   Tue, 3 Feb 2004 14:00:44 +0000 (GMT)

On Tue, 3 Feb 2004, Nick Cox wrote:
> Allan is incorrect ...

Agreed, and I had completely misread Ben's problem.  Also, the code I
offered had a missing index

> >    loc nn = _N
> >    gen y = .
> >    forvalues i = 1/`nn' {
> >       replace y = x in rankx[`i']
> >    }

The difference between this and "gen y = x[z]" is that rankx does not
point to the element in x to be copied, but to the position in y where it
is to go.

* gen y[rankx] = x

is the code that is disallowed - but by the time you read this it may be
in the latest upgrade.


*
*   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