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
Related Posts with Define a binary variable using and / or
Converting globals in to scalarsHi all I have a question. During my .do file I created some globals in which I stored the value of …
replace if with no real changes madeDear Statalist, I have a variable State with storage type str3. I want to creat a dummy variable, 1…
foreach loop with fe (fixed effects) and constraintsHi I want to run fixed effects regression together with some restrictions(constraints) for 250 cros…
Correlation of the change of the current and the previous variable (autocorrelation)Hi, I am trying to find the auto correlation of current earnings change and past earnings change, bu…
Multivariate logistic regressioncode for Multivariate analysis …
Subscribe to:
Post Comments (Atom)
0 Response to Define a binary variable using and / or
Post a Comment