Hope everyone is blessed with good health.
I've panel dataset,
SARS = containing non-zero and zero values and proxy for past exogenous shock
I want to generate a dummy variable that equals one if firm ever experience SARS in its life-span.
The Problem I'm currently facing is: "When I generate the dummy variable by the following command, it only account for the year in which firm have non-zero value"
What I want is: " if a firm has non-zero value, then assign one for all years of that firm"
gen sarsd = 0
replace sarsd = 1 if sars > 0
replace sarsd = 0 if missing(sars)
replace sarsd = 1 if sars > 0
replace sarsd = 0 if missing(sars)
Thanks
0 Response to generating dummy variable in panel data (firm-wise)
Post a Comment