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

st: RE: RE: Trouble with `=`_N'-1'

From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: Trouble with `=`_N'-1'
Date   Mon, 1 Sep 2008 16:50:37 +0100

Just to underline Martin's analysis: the reference `_N' would be
appropriate if _N were the name of a local macro, but _N is not a local

[email protected] 

Martin Weiss

Stata does not know what to do about `_N', so it evaluates to nothing.
whole -in- statement evaluates to - in -1 - which denotes the last
observation. Say -replace line = 5 in `=_N-1'- and it works fine. Now _N
well defined and the expression evaluates to the desired value. Note
you could have put - in -2 - to begin with, and would have saved
the trouble...

Ashim Kapoor

I wish to make a change in the 2nd last observation.

so I have : replace line = 5 in `=`_N'-1'

But this change the LAST observation! Am I doing something wrong?

funnily replace line = 5 if _n==_N-1 works fine!

*   For searches and help try:

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