Dear all,
I have a panel data set. Each observation is organized by firmId and year. Some other variables include firms’ industry classification code (SIC) storage type integer.
I need to define a binary variable set equal to one if a firm’s SIC code between 2833 and 2836, 3570 and 3577, 3600 and 3674; and zero otherwise.
I plan to use
gen sic_dum=0
replace sic_dum =1 if (sic>=2833 & sic <=2836) | sic>= 3570 & sic <=3577 | sic>= 3600 & sic <=3674)
But I am not sure whether & takes precedence than | using these conditional statement).
Thank you,
Rochelle
0 Response to Define a binary variable using and / or
Post a Comment