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/