Stata does not know what to do about `_N', so it evaluates to nothing. The
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 is
well defined and the expression evaluates to the desired value. Note that
you could have put - in -2 - to begin with, and would have saved yourself
the trouble...
HTH
Martin
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Ashim Kapoor
Sent: Monday, September 01, 2008 1:20 PM
To: [email protected]
Subject: st: Trouble with `=`_N'-1'
Hello everyone,
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!
Any tips?
Thank you,
Ashim.
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/