Statalist The Stata Listserver


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

Re: st: recoding variables


From   Austin Nichols <[email protected]>
To   [email protected]
Subject   Re: st: recoding variables
Date   Thu, 9 Feb 2006 14:54:17 -0500

g risk=(tob<pok)+2*(tob>pok)+3*(tob==pok) if !mi(tob,pok)

On 2/9/06, Krista Richard <[email protected]> wrote:
> Hello,
>
> I'm new to stata and I need help to recode two variables into one. I'm not
> succeeding so I'm hoping someone will be able to help me out.
>
> I have two variables:
>
> age at first poker use (poker) and age of first tobacco use (tobacco).
>
> I want to create a variable (risk_behaviour) with 3 levels that will have
> the value labels of 1 = tobacco<poker, 2 = tobacco>poker, and 3
> tobacco=poker.  I run into trouble with this as stata is treating my
> missing values when it calculates it and I can't seem to make it not
> compute this when either original variable has missing values.
>
> Any suggestions on the syntax I can use?
>
> Many thanks.
> *
> *   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/
>

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