Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Unreasonable error "Obs. nos. out of range"


From   Stefan Bernhard <[email protected]>
To   statalist <[email protected]>
Subject   st: Unreasonable error "Obs. nos. out of range"
Date   Mon, 17 Jun 2013 16:21:31 +0200

dear statalisters,

i have a piece of looping code over different variables and all
observations, and an excerpt of the trace shows this:

= if cats[2] == 0 {
  local bak = 0
  }
- noi di as text "bak is `bak'"
= noi di as text "bak is 0"
bak is 0
- replace `var' = 1 in `i'
= replace cats = 1 in 2
Obs. nos. out of range


This makes no sense at all to me.

In the first line, it successfully uses the value of cats of
observations number 2 to define the local bak as 0.

Few lines later, it acts as if there was no more observations number 2
and cannot replace the number of cats with 1 in observation number 2.

Why does it say Obs. nos. out of range ?

regards, stefan bernhard,
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index