I have a panel data set identified by an id variable and one specific string variable with different values for each time period (weekly). Not every id is represented in every week (new can come and older can vanish).
I created a dummy when this variable contains a specific term, but it only captures the single appearance in a week. What I would like to have is that each id has a specific dummy that indicates whether the term is contained in the string variable in at least one week's occurrence. So in case in week 34 id x contains the term, i'd like to have a dummy for all the other weeks as well, that shows a "1", as the term once was contained for id x
I tried formatting as an xtset
and replacing via F.
, but that didn't work as expected.