Announcement

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

  • Vlookup sort of command in STATA


    Dear colleagues,

    obs id a b1 b2
    1 1 1 3 2
    2 1 2 .
    3 1 3 5 .
    4 1 4 .
    5 2 3 2 .
    6 2 6 3 6
    7 2 7 8 .
    8 2 8 1 .



    I'm working on large dataset that consists more than 900 groups and 5000 obs .I want to check and list whether b variable consists in variable "a" by groups (id var) or not?

    For example b1=3 can be found in var "a" as well (excel obs#=3 and id=1) and similarly b2=2 can be found in "a" in id==1; opposite is the case of for b1=5 - 5 cannot be found in "a" for id=1. In other words "b" must be part of "a" within same id group.

    Example 2: Obs#5 where b1=2 is not part of a within same group.
    Example 3: b1=3 is present in a within same group but b2=9 is not part of "a"


    i have 4 "b" vars b1-b4 - all the values from (if not missing) must be present in "a" with same id and i want to list (or may be export in excel) all the list of mismatches. Can anyone help?


  • #2
    Code:
    search vlookup, all
    See also http://www.statalist.org/forums/foru...re-a-1-1-match
    Last edited by Nick Cox; 29 Jan 2016, 03:41.

    Comment


    • #3
      Thanks Vlookup worked.

      Comment

      Working...
      X