Dear Stata users,
I'm struggling with creating a dummy indicating belong to one of the two groups. I have a panel data. I want to create a dummy indicating that a firm is either important or is polish. I wanted to have fixed timing. That's why I wanted to have a state from 2019 for all firms.
I used the code:
Then I browsed and noticed I didn't get what I wanted to achieve. E.g I see that the indicator Importance equals 1 and I see my dummy imp_polish=0. I wanted to have all important firms + polish firms. It is what I want. Please help me. I don't understand what I'm doing wrong
I'm struggling with creating a dummy indicating belong to one of the two groups. I have a panel data. I want to create a dummy indicating that a firm is either important or is polish. I wanted to have fixed timing. That's why I wanted to have a state from 2019 for all firms.
I used the code:
Code:
gen imp_polish=0 replace imp_polish=cond(year==2019,1,.) if Importance==1| PL==1 replace imp_polish=imp_polish[_N]

Comment