Announcement

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

  • new variable with conversion

    I am totally new to STATA and am trying to learn by looking at examples.
    In the following piece of code a new variable is generated using a substring command which I do not understand.

    gen int cci_ami = 0
    foreach v of varlist icd_hd icd_nd1 - icd_nd89 {
    quietly replace cci_ami = 1 if inlist(substr(`v',1,3),"I21","I22") | inlist(substr(`v',1,4),"I252")

    Could someone explain this to me stepwise?

    Thank you for your help!
Working...
X