Announcement

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

  • Similar names in a variable list

    Statalist,

    I have a list of 2000 drugs; among those, there are drugs with slightly different names/doze. I would like to combine similar names. For example, below, each color would be considered a drug (class). Is there any way to do it rather than checking one by one, then recoding in STATA?
    Thank you

    Click image for larger version

Name:	Capture rx.PNG
Views:	1
Size:	13.1 KB
ID:	1702190

  • #2
    You may need to do some manual checking, but you could start with just taking the first word or two as the name of the active ingredient.

    Using the first word only:

    Code:
    gen class=word(lower(drug),1)
    If you have multiple active ingredients, you will need to parse them out.

    Comment

    Working...
    X