Hello,
I try to use the egen command to define a percentile for different agreements (here called PTA_*). So I use the following loop:
I get an error message saying that the option if is not allowed. The problem is the first "if" (in the egen command). I don't understand why I get this message since the egen command is compatible with if option.
Could anyone let me know how can I fix this?
I try to use the egen command to define a percentile for different agreements (here called PTA_*). So I use the following loop:
Code:
forval v=1/955 { capture confirm var PTA_`v'_j if _rc == 0 { bysort prod year : egen p75KL_`v' = pctile(diffKL_jw), p(75) if PTA_`v'_j == 1 gen extKL_`v' = 1 if p75KL_`v' <= diff_jw & PTA_`v'_j == 1 } }
Could anyone let me know how can I fix this?
Comment