JMSLab / xtevent

Stata package -xtevent-
MIT License
43 stars 12 forks source link

Erroneously dropping variables owing to inexact variable name match #204

Closed Constantino-Carreto-Romero closed 3 months ago

Constantino-Carreto-Romero commented 3 months ago

Per comment: https://github.com/JMSLab/xtevent/issues/203#issuecomment-2111173670

Check the following example

use example31, clear 
xtevent y eta, panelvar(i) timevar(t) pol(z) impute(stag) window(3) savek(aa)
rename aa_evtime aa_evtime_myvar
xtevent y eta, panelvar(i) timevar(t) pol(z) impute(stag) window(3) savek(aa, replace)

the variable aa_evtime_myvar was erroneously dropped. In general, we should check all the inexact variable matches done with unab.

jorpppp commented 3 months ago

@Constantino-Carreto-Romero Make sure to merge from main here before adding extra commits here since we just closed #203 and #206

Constantino-Carreto-Romero commented 3 months ago

@jorpppp in https://github.com/JMSLab/xtevent/commit/359645066af4c4598785006f88066e2fa7c5d074 I implemented an exact check of the event-time dummies, event-time variable, trend variable, and interaction variables, so if required, the program drops only the variables that exactly match specific names. in https://github.com/JMSLab/xtevent/commit/9d5bb89445dd541ee11d8c693b8c4e0839681117 I uploaded a do-file with examples to test the implementation. I also ran the test file without inconvenience.

jorpppp commented 3 months ago

Looks good, thanks @Constantino-Carreto-Romero. I'll start a PR.

jorpppp commented 3 months ago

Summary: In this issue we fixed a bug where some variables were being dropped due to inexact variable name matches.

Thread continues in #209