Statalist The Stata Listserver


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

Re: st: use of *OR* | in 'replace'


From   Steffen Hokland <hokland@MR.AU.DK>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: use of *OR* | in 'replace'
Date   Thu, 2 Mar 2006 12:20:36 +0100

. replace Include=1 if Temp==1 | Dose_Group<35
(26 real changes made)
Well it's obviously possible. However, what about this one:

***************************************************************
 set obs 10
obs was 0, now 10

. gen mouse = _n

. gen Dose_Group = 1

. replace Dose_Group = 2 if mouse > 32
(0 real changes made)

. replace Dose_Group = 2 if mouse > 3
(7 real changes made)

. replace Dose_Group = 3 if mouse > 6
(4 real changes made)

. gen Temp=41.5

. replace Temp = 42.5 if mouse > 5
(5 real changes made)

. gen Include = 0

. replace Include=1 if Dose_Group > 2 | Temp==41.5
(9 real changes made)

. drop Include

. gen Include = 0

. replace Include=1 if Temp==41.5 Dose_Group > 2
invalid 'Dose_Group'
r(198);
***************************************************************

I'm certain that there's some logical explanation - it just eludes me.

Steffen
*
*   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–2020 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index