Statalist The Stata Listserver


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

st: recoding variables


From   Krista Richard <[email protected]>
To   [email protected]
Subject   st: recoding variables
Date   Thu, 9 Feb 2006 14:35:06 -0500

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/



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