Thursday, March 02, 2006

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

You seem to have left out the actual OR statement:

. replace Include=1 if Temp==41.5 Dose_Group > 2

should read

. replace Include=1 if Temp==41.5 | Dose_Group > 2

Best,

Henrik

Steffen Hokland wrote: >> . 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/ >

-- Henrik Støvring, PhD

Research Unit of General Practice University of Southern Denmark J.B. Winsløws Vej 9 DK-5000 Odense C Phone: (+45) 6550 3692 Fax: (+45) 6591 8296 email: hstovring@health.sdu.dk Homepage: http://www.biostat.sdu.dk/~stovring ------------------------------------------------------------------ * * 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/


Tag:


Links to this post:

Create a Link



<< Home

This page is powered by Blogger. Isn't yours?