Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

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


From   Stefan Bernhard <stefanbernhard88@gmail.com>
To   statalist <statalist@hsphsun2.harvard.edu>
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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index