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
Time series means of coefficient estimates from cross-sectional regressions.Hi all, I have 29 annual cross-sectional regressions that I want to summarise the findings in a sin…
Create a variable (0/1) based on multiple variables containing stringHello, I want to tell stata to create a variable giving a code of 0/1 based on around 200 variables…
Workflow for Stata for Windows ReleasedI have been developing a set of customized keyboard shortcuts for the past couple of years to create…
Use a substring of a variable name to refer to likewise named variablesDear forum, I have a number of datasets, each consisting of various years. On each file I run the sa…
Mistake in loop for renaming variables of several datafilesDear Statalists, I have ten identically structured excel files which correspond to ten different yea…
Subscribe to:
Post Comments (Atom)
0 Response to Define a binary variable using and / or
Post a Comment