Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: -generate- and run time contingencies


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: -generate- and run time contingencies
Date   Mon, 30 Jan 2006 17:11:51 -0000

"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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index