Statalist The Stata Listserver


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

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


From   Ronán Conroy <rconroy@rcsi.ie>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: use of *OR* | in 'replace'
Date   Thu, 2 Mar 2006 10:54:07 +0000

On 2 Márta 2006, at 10:10, Steffen Hokland wrote:

E.g.
- Variable Temp can take values of 40.5, 41.5 and 42.5
- Variable Dose_Group can take values from 1 -- 14

Then
gen Include=0
replace Include=1 if Temp==42.5 | Dose_Group<3
returns:
Dose_Group invalid name
r(198)
I've tried different combinations of parantheses in the expression (for some reason I can make an AND-statement work).

Can someone tell me the correct syntax, or is OR-statements just not allowed in replace?
Funny -

. sysuse auto, clear
(1978 Automobile Data)

. rename foreign Temp

. rename turn Dose_Group

. gen Include=0

. replace Include=1 if Temp==1 | Dose_Group<35
(26 real changes made)

.


Ronán Conroy
rconroy@rcsi.ie




*
*   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