Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Create a dummy variable meeting 2 conditions

From   Steve Samuels <>
Subject   Re: st: Create a dummy variable meeting 2 conditions
Date   Mon, 24 Feb 2014 17:37:12 -0500

Billy has answered your question, but I want to point out that you are
not following the very strong request in the Statalist FAQ to use your
full real name when posting.


Steve Samuels

On Feb 24, 2014, at 4:43 PM, Li <> wrote:

Dear Statalist members,

    I have a question with regard to create a Dummy variable from two
variables. The coding of the two existing variables are as follows:

     Var1: ( 1=smoked over 100 cigars lifetime ; 2 = Not smoked 100
cigars lifetime; 3= don't know; 99=missing).
     Var2: (1=currently smoke every day; 2=currently smoke some days;
3=not smoking; 4=refuse to answer; 99=missing).

The new dummy variable I want to create needs to satisfy two
conditions: smoked over 100 cigars lifetime and currently smoking
everyday or some days, i.e.

New variable        1=current smoker (if Var1=1 & Var2=1 or 2);


                          . = Missing, don't know and refuse to
answer in Var1, Var2).

I know it is straightforward to use the "gen" in Stata to meet one
condition. I would appreciate if anyone shares how to incorporate the
conditions as above to make a new variable.

Thank you very much.

*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index