Hi all,
I am working with a large firm level data. the firms are divided into various industry groups and sub-groups. For each industry group, I want to generate a dummy variable which takes value 1 if a given firm is in that industry and zero otherwise. Eg. in the data below, there are three main industry groups- food, textiles and chemicals (each with sub-groups).
So for chemicals for instance, I want to define a dummy which = 1 if Industry_Code lies in the range [10101200000, 10101202500] and zero otherwise. Using "|" with the if qualifier does not seem to work.
How can I do this?
Best,
Ananya
I am working with a large firm level data. the firms are divided into various industry groups and sub-groups. For each industry group, I want to generate a dummy variable which takes value 1 if a given firm is in that industry and zero otherwise. Eg. in the data below, there are three main industry groups- food, textiles and chemicals (each with sub-groups).
So for chemicals for instance, I want to define a dummy which = 1 if Industry_Code lies in the range [10101200000, 10101202500] and zero otherwise. Using "|" with the if qualifier does not seem to work.
Industry_Code | Industry |
10101110000 | Food |
10101110101 | Dairy products |
10101110105 | Tea |
10101150000 | Textiles |
10101150100 | Cotton & blended yarn |
10101150500 | Cloth |
10101151000 | Man-made filaments & fibres |
10101151500 | Textile processing |
10101200000 | Chemicals |
10101200100 | Inorganic chemicals |
10101200500 | Caustic soda |
10101201000 | Soda ash |
10101201500 | Fertilisers |
10101202000 | Pesticides |
10101202500 | Dyes & pigments |
How can I do this?
Best,
Ananya
Comment