lukestein’s avatarlukestein’s Twitter Archive—№ 3,497

        1. Ever since learning how to refer to Stata's labeled values by name (from👇), I've used it a TON and loved it. But today I ran into a sneaky bug in my code, and if you use the "label":valuelabel construction you should understand this and be careful. 1/ @AmandaYAgan/1126149848548376577
      1. …in reply to @lukestein
        Here's a short snipped that demonstrated the problem. Note that in line 12, if county == "Baltimore":county FAILS to find the relevant observation. (The construction in line 20 works fine.) 2/
        oh my god twitter doesn’t include alt text from images in their API
    1. …in reply to @lukestein
      The problem can arise when you have more than one numerical value with the same label, like label define county 0 "Baltimore" 1 "Baltimore" 2 "New York" When Stata sees "Baltimore":county, it evaluates to 0 so misses Baltimore observations with county == 1. 3/
      oh my god twitter doesn’t include alt text from images in their API
  1. …in reply to @lukestein
    Of course *after* banging my head against the wall and finally figuring out what was going on, I found a Tweet where brilliant @davidmolitor warns about this and suggests -labelbook- as a way of finding value labels that are not "unique at full length." 4/ @davidmolitor/1126275796706918400
    1. …in reply to @lukestein
      @davidmolitor Last tweet in this thread will be to re-up, once again, my suggestion to check out stata_kernel for running Stata code interactively. If you are used to a bunch of selecting lines then Apple-Shift-D (or non-Mac equivalent) this will rock your world. 5/5 @lukestein/1100227720162598913