dinsdag 5 februari 2013

Coding sectors based on NACE rev 1.1 and NACE rev. 2


Below is a broad categorisation of the NACE activities in four groups:

  1. Primary sector and construction
  2. Manufacturing and energy (including water, waste and recycling)
  3. Services and entertainment
  4. Public sector, education and health (including libraries)

The syntax below can be used in Stata straight away:

Based on NACE rev. 1.1

gene s_industryR1 = .
replace s_industryR1 = 1 if y10_nace_rev1 >= 1 & y10_nace_rev1 <= 14 // primary sector + construction
replace s_industryR1 = 1 if y10_nace_rev1 == 45 // primary sector + construction
replace s_industryR1 = 2 if y10_nace_rev1 >= 15 & y10_nace_rev1 <= 41 // manufacturing + energy ressources
replace s_industryR1 = 2 if y10_nace_rev1 == 90 // manufacturing + energy ressources
replace s_industryR1 = 3 if y10_nace_rev1 >= 50 & y10_nace_rev1 <= 74 // services + entertainment
replace s_industryR1 = 3 if y10_nace_rev1 >= 91 & y10_nace_rev1 <= 97 // services + entertainment
replace s_industryR1 = 4 if y10_nace_rev1 >= 75 & y10_nace_rev1 <= 85 // PEH
replace s_industryR1 = 4 if y10_nace_rev1 == 99 // PEH


Based on NACE rev. 2

gene s_industryR2 = .
replace s_industryR2 = 1 if y10_nace_rev2 >= 1 & y10_nace_rev2 <= 9 // primary sector + construction
replace s_industryR2 = 1 if y10_nace_rev2 >= 41 & y10_nace_rev2 <= 43 // primary sector + construction
replace s_industryR2 = 2 if y10_nace_rev2 >= 10 & y10_nace_rev2 <= 39 // manufacturing + energy ressources
replace s_industryR2 = 3 if y10_nace_rev2 >= 45 & y10_nace_rev2 <= 82 // services + entertainment
replace s_industryR2 = 3 if y10_nace_rev2 >= 92 & y10_nace_rev2 <= 98 // services + entertainment
replace s_industryR2 = 3 if y10_nace_rev2 == 90 // services + entertainment
replace s_industryR2 = 4 if y10_nace_rev2 >= 84 & y10_nace_rev2 <= 88 // PEH
replace s_industryR2 = 4 if y10_nace_rev2 == 91 // PEH
replace s_industryR2 = 4 if y10_nace_rev2 == 99 // PEH

Info on the box: http://www.quackit.com/html/codes/horizontal_scroll.cfm