"making -replace- r-class 
would likely break all kinds of programs"
You hit it in one, I think. 
Nick 
[email protected] 
Nick Winter
 
> Nick Cox had a slightly shorter version, eliminating the creation of 
> the OK variable.
> 
> I am reminded again that it would be nice if the -replace- command 
> somehow left behind the number of changes it makes (which it 
> displays, but does not leave for a program to pick up.)  It's been 
> discussed before on statalist I think, and making -replace- r-class 
> would likely break all kinds of programs, but still it would be handy 
> to be able to get to that somehow....
 
n j cox 
> >>// not tested
> >>gen x = uniform()
> >>gen byte OK = x >= 0.8
> >>capture assert OK == 1
> >>
> >>while _rc {
> >>         replace x = cond(x < 0.8, uniform(), x)
> >>         replace OK = x >= 0.8
> >>         capture assert OK == 1
> >>}
> >
*
*   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/