Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • And/or symbol

    Is there an and/or command in Stata? I would like to generate a variable (recoverev) that would equal 1 if one or both variables (gaf11 and/or gaf12) is greater than or equal to 61. This is the code I have so far

    gen recoverev=1 if gaf11>=61 | gaf12>=61
    replace recoverev=0 if recoverev!=1

    Where I currently have an or symbol in between gaf11>=61 and gaf12>=61, I need a symbol for and/or

  • #2
    And/or is not necessary because if you draw a Venn diagram, the "AND" is in the overlapping area, and it'd be 1 if either of the circle is 1; and it cannot be 1 if both circles are 0. Whatever you have is fine to capture both AND as well as OR.
    Last edited by Ken Chui; 23 Aug 2021, 16:20.

    Comment


    • #3
      Thank you!

      Comment


      • #4
        Another way to say what Ken is saying, is that Stata's OR is the inclusive OR operator meaning either A, or B, or both.

        Also what you are doing can be done in one line:

        Code:
        gen recoverev= gaf11>=61 | gaf12>=61

        Comment

        Working...
        X