Announcement

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

  • dropping observations if 2 strings are empty

    Hi

    I want to drop all observations which don't have date in 2 string variables:

    for example
    if A = empty and B=empty --> drop
    if A or B != empty --> dont drop

    I tried drop if A == "" and B== "" but it states a invalid and operation

    i cant include a dataex because the characters in one of the variables are too long.

    Thanks in advance!



  • #2
    The AND logical operator in Stata is &:
    Code:
    A=="" & B==""
    See -help operator-.

    You can also use:
    Code:
    missing(B) & missing(A)

    Comment


    • #3
      Ah i guess i am used to the python syntax. Thanks Ali

      Comment

      Working...
      X