Announcement

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

  • psmatch2 - Mahalanobis matching in a loop

    Hi statalists,

    I would like to use Mahalanobis matching in a loop. I think there is a problem within my code related to psmatch2(line 3). However, I don't know how to fix it. Can anyone provide ideas? Thanks!

    Code:
    levels firmrating, local(gr)
    foreach j of local gr{
        psmatch2 Dummy, mahal(V1 V2 V3 V4) if firmrating == `j', out(IndVar)
        foreach var in pscore treated support weight IndVar id n1 pdif{
            replace `var'=_`var' if firmrating == `j'
        }
    }

  • #2
    In Stata syntax, the -if- qualifier appears in the main command line and is not part of the options. Standardly, one comma is used to separate the main command line and the options.


    psmatch2 Dummy, mahal(V1 V2 V3 V4) if firmrating == `j', out(IndVar)
    should read

    Code:
    psmatch2 Dummy if firmrating == `j', mahal(V1 V2 V3 V4) out(IndVar)

    Comment


    • #3
      Your code works! Thanks for helping again ^^

      Comment

      Working...
      X