Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: generate if [exp], otherwise


From   "David Harrison" <David@icnarc.org>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: generate if [exp], otherwise
Date   Thu, 12 Aug 2004 09:31:47 +0100

gen newvar=cond(x<5,y+1,y)

David
david@icnarc.org

-----Original Message-----
From: Mark Clatworthy [mailto:ClatworthyMA@Cardiff.ac.uk]
Sent: 12 August 2004 09:25
To: statalist@hsphsun2.harvard.edu
Subject: st: generate if [exp], otherwise


I would like to generate a newvar which is equal to variable y +1 if variable x
is less than 5, but equal to variable y if variable x is greater than 5.  




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