Dear Statalist,
assume there is one variable x with 10 observations filled with
random numbers between 0 and 10.
the 11th observation should carry the value 1 if ANY observation of x
is <2, 2 if any observation is between 2 and 5, and 3 if any
observation is bigger than 5.
I tried the following:
local obs = 10
local count = 0
while `count' <= `obs' {
replace x = 1 if x < 2 in `count'
replace x = 2 if ....and so so on
}
apparently, this does not work as intended, as this loop does not
place the values 1, 2, 3 in the last observation but in the
observation `count'
I actually need an additional "in"
replace x = 1 in L if x < 2 in `count'
Unfortunately, stata does not allow for this systanx
Do you have any hint for a workaround?
Best,
Christian
*
* 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/