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

st: replace and variable subscripts


From   "Sergey Chernenko" <[email protected]>
To   <[email protected]>
Subject   st: replace and variable subscripts
Date   Thu, 10 Mar 2005 03:56:36 -0500

Dear Stata Users:

Is the following behavior of -replace- documented anywhere?

. set obs 10
obs was 0, now 10
. gen x = _n
. replace x = x - x[1]
(1 real change made)
. fl
     +------------+
     |          x |
     |------------|
  1. |          0 |
  2. |          2 |
  3. |          3 |
  4. |          4 |
  5. |          5 |
     |------------|
  6. |          6 |
  7. |          7 |
  8. |          8 |
  9. |          9 |
 10. |         10 |
     +------------+

I would have expected -replace- to subtract 1 from each observation, not
just the first one.

Thanks.

Sergey

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