*! version 1.2  14Oct2004 John_Hendrickx@yahoo.com
* Stata version June 20, 2001 by John Hendrickx <John_Hendrickx@yahoo.com>
/*
October 14, 2004
Added `tmpsv' ~= . condition to lines 76 and 77,
checked for no further occurances of a ">" or >=" condition
without either an upper boundary or a "~=." condition
September 28, 2004
Added condition `tmpsv' ~= . to line 658
quietly replace `varlist'=2  if  (`varlist' == 3 & `tmpsv' >= 1 & `tmpsv' ~= .);

Transforms ISCO-88 (International Classification of Occupation)
4-digit occupational codes into
a 10 category EGP scale (Erikson, Goldthorpe, Portocarero)

Source:
Ganzeboom, Harry B.G.;Treiman, Donald J.,
International Stratification and Mobility File: Conversion Tools.
Utrecht: Department of Sociologie,
http://www.fss.uu.nl/soc/hg/ismf.

ISCO-88 Reference:
ILO (International Labour Office). (1990).
International standard classification of occupations : ISCO-88.
Geneva: International Labour Office.

EGP Reference:
Erikson, R., J.H. Goldthorpe, L. Portocarero. (1979).
International class mobility in three Westen European Countries:
England, France, and Sweden.
British Journal of Sociology 30: 415-451.

Categories:
	  1 "higher controllers"
	  2 "lo controllers"
	  3 "routine nonmanual"
	  4 "sempl with emp"
	  5 "sempl without empl"
	  7 "manual supervisor"
	  8 "skilled manual"
	  9 "semi-unskilld manual"
	 10 "farm labor"
	 11 "selfempl farm"
*/
program define iskoegp
	version 7
	syntax newvarname, isko(varname numeric) sempl(varname numeric) supvis(varname numeric)

	/* SPSS comments:
	** last fix: summer 1994

	** Please cite use of our conversion tools as:
	** "Ganzeboom, Harry B.G.;Treiman, Donald J.,
	** International Stratification and Mobility
	** File: Conversion Tools. Utrecht: Department of Sociologie,
	** http://www.fss.uu.nl/soc/hg/ismf." Date of last revision.

	** STANDARD RECODE OF OCCUPATIONS IN EGP SCORE
	* THE MODULE HAS BEEN CHANGED TO A FORMAT FOR AN INDETERMINATE
	* NUMBER OF VARIABLES. YOU NEED TO DEFINE IN YOUR FILE THE FOLLOWING
	* MACRO VARIABLES:
	* @ISKO
	* @EGP10
	* @SEMPL
	* @SUPVIS
	*/

	* Start of ISKOPROM.INC section
	* job titles considered to be promotable

	tempvar tmpsv
	gen `tmpsv'=`supvis'
	quietly replace `tmpsv'=5 if (`isko' == 7510 & `supvis' <= 0)
	tempvar tmpisko
	gen `tmpisko'=`isko'
	quietly replace `tmpisko'=1311 if ((`isko' >= 6100 & `isko' <= 6133) & `tmpsv' >= 1 & `tmpsv' ~= .)
	quietly replace `tmpisko'=6132 if ((`isko' >= 9200 & `isko' <= 9213) & `tmpsv' > 1 & `tmpsv' ~= .)
	quietly replace `tmpisko'=1221 if (`isko' == 1311 & `tmpsv' > 10 & `tmpsv' ~= .)
	quietly replace `tmpisko'=1222 if (`isko' == 1312 & `tmpsv' > 10 & `tmpsv' ~= .)
	quietly replace `tmpisko'=1223 if (`isko' == 1313 & `tmpsv' > 10 & `tmpsv' ~= .)
	quietly replace `tmpisko'=1224 if (`isko' == 1314 & `tmpsv' > 10 & `tmpsv' ~= .)
	quietly replace `tmpisko'=1225 if (`isko' == 1315 & `tmpsv' > 10 & `tmpsv' ~= .)

	quietly replace `tmpisko'=1226 if (`isko' == 1316 & `tmpsv' > 10 & `tmpsv' ~= .)
	quietly replace `tmpisko'=1227 if (`isko' == 1317 & `tmpsv' > 10 & `tmpsv' ~= .)
	quietly replace `tmpisko'=1228 if (`isko' == 1318 & `tmpsv' > 10 & `tmpsv' ~= .)
	quietly replace `tmpisko'=1229 if (`isko' == 1319 & `tmpsv' > 10 & `tmpsv' ~= .)
	quietly replace `tmpisko'=1220 if ((`isko' == 1300 | `isko'==1310) & `tmpsv' > 10 & `tmpsv' ~= .)

	quietly replace `tmpisko'=1311 if (`isko' == 1221 & (`tmpsv' >= 1 & `tmpsv' <= 10))
	quietly replace `tmpisko'=1312 if (`isko' == 1222 & (`tmpsv' >= 1 & `tmpsv' <= 10))
	quietly replace `tmpisko'=1313 if (`isko' == 1223 & (`tmpsv' >= 1 & `tmpsv' <= 10))
	quietly replace `tmpisko'=1314 if (`isko' == 1224 & (`tmpsv' >= 1 & `tmpsv' <= 10))
	quietly replace `tmpisko'=1315 if (`isko' == 1225 & (`tmpsv' >= 1 & `tmpsv' <= 10))
	quietly replace `tmpisko'=1316 if (`isko' == 1226 & (`tmpsv' >= 1 & `tmpsv' <= 10))
	quietly replace `tmpisko'=1317 if (`isko' == 1227 & (`tmpsv' >= 1 & `tmpsv' <= 10))
	quietly replace `tmpisko'=1318 if (`isko' == 1228 & (`tmpsv' >= 1 & `tmpsv' <= 10))
	quietly replace `tmpisko'=1319 if (`isko' == 1229 & (`tmpsv' >= 1 & `tmpsv' <= 10))
	#delimit ;
	quietly replace `tmpisko'=1310 if ((`isko' == 1200 | `isko' == 1210 | `isko' == 1220) &
	                                   (`tmpsv' >= 1 & `tmpsv' <= 10));
	quietly replace `tmpisko'=1210 if ((`isko' == 1220 |
	                                   (`isko' >= 1222 & `isko' <= 1229)) &
	                                    `sempl' == 1 &
	                                    `tmpsv' >= 11 & `tmpsv' ~= .);
	#delimit cr

	* Start of ISKOROOT.INC section
	quietly gen `varlist'=.
	quietly replace `varlist'=1  if (`tmpisko' == 1000)
	quietly replace `varlist'=1  if (`tmpisko' == 1100)
	quietly replace `varlist'=1  if (`tmpisko' == 1110)
	quietly replace `varlist'=1  if (`tmpisko' == 1120)
	quietly replace `varlist'=2  if (`tmpisko' == 1130)
	quietly replace `varlist'=2  if (`tmpisko' == 1140)
	quietly replace `varlist'=2  if (`tmpisko' == 1141)
	quietly replace `varlist'=2  if (`tmpisko' == 1142)
	quietly replace `varlist'=2  if (`tmpisko' == 1143)
	quietly replace `varlist'=1  if (`tmpisko' == 1200)
	quietly replace `varlist'=1  if (`tmpisko' == 1210)
	quietly replace `varlist'=1  if (`tmpisko' == 1220)
	quietly replace `varlist'=11 if (`tmpisko' == 1221)
	quietly replace `varlist'=1  if (`tmpisko' == 1222)
	quietly replace `varlist'=1  if (`tmpisko' == 1223)
	quietly replace `varlist'=1  if (`tmpisko' == 1224)
	quietly replace `varlist'=1  if (`tmpisko' == 1225)
	quietly replace `varlist'=1  if (`tmpisko' == 1226)
	quietly replace `varlist'=1  if (`tmpisko' == 1227)
	quietly replace `varlist'=1  if (`tmpisko' == 1228)
	quietly replace `varlist'=1  if (`tmpisko' == 1229)
	quietly replace `varlist'=1  if (`tmpisko' == 1230)
	quietly replace `varlist'=1  if (`tmpisko' == 1231)
	quietly replace `varlist'=1  if (`tmpisko' == 1232)
	quietly replace `varlist'=1  if (`tmpisko' == 1233)
	quietly replace `varlist'=1  if (`tmpisko' == 1234)
	quietly replace `varlist'=1  if (`tmpisko' == 1235)
	quietly replace `varlist'=1  if (`tmpisko' == 1236)
	quietly replace `varlist'=1  if (`tmpisko' == 1237)
	quietly replace `varlist'=1  if (`tmpisko' == 1239)
	quietly replace `varlist'=2  if (`tmpisko' == 1240)
	quietly replace `varlist'=1  if (`tmpisko' == 1250)
	quietly replace `varlist'=1  if (`tmpisko' == 1251)
	quietly replace `varlist'=2  if (`tmpisko' == 1252)
	quietly replace `varlist'=2  if (`tmpisko' == 1300)
	quietly replace `varlist'=2  if (`tmpisko' == 1310)
	quietly replace `varlist'=11 if (`tmpisko' == 1311)
	quietly replace `varlist'=2  if (`tmpisko' == 1312)
	quietly replace `varlist'=2  if (`tmpisko' == 1313)
	quietly replace `varlist'=2  if (`tmpisko' == 1314)
	quietly replace `varlist'=2  if (`tmpisko' == 1315)
	quietly replace `varlist'=2  if (`tmpisko' == 1316)
	quietly replace `varlist'=2  if (`tmpisko' == 1317)
	quietly replace `varlist'=2  if (`tmpisko' == 1318)
	quietly replace `varlist'=2  if (`tmpisko' == 1319)
	quietly replace `varlist'=1  if (`tmpisko' == 2000)
	quietly replace `varlist'=1  if (`tmpisko' == 2100)
	quietly replace `varlist'=1  if (`tmpisko' == 2110)
	quietly replace `varlist'=1  if (`tmpisko' == 2111)
	quietly replace `varlist'=1  if (`tmpisko' == 2112)
	quietly replace `varlist'=1  if (`tmpisko' == 2113)
	quietly replace `varlist'=1  if (`tmpisko' == 2114)
	quietly replace `varlist'=1  if (`tmpisko' == 2120)
	quietly replace `varlist'=1  if (`tmpisko' == 2121)
	quietly replace `varlist'=1  if (`tmpisko' == 2122)
	quietly replace `varlist'=1  if (`tmpisko' == 2130)
	quietly replace `varlist'=1  if (`tmpisko' == 2131)
	quietly replace `varlist'=2  if (`tmpisko' == 2132)
	quietly replace `varlist'=2  if (`tmpisko' == 2139)
	quietly replace `varlist'=1  if (`tmpisko' == 2140)
	quietly replace `varlist'=1  if (`tmpisko' == 2141)
	quietly replace `varlist'=1  if (`tmpisko' == 2142)
	quietly replace `varlist'=1  if (`tmpisko' == 2143)
	quietly replace `varlist'=1  if (`tmpisko' == 2144)
	quietly replace `varlist'=1  if (`tmpisko' == 2145)
	quietly replace `varlist'=1  if (`tmpisko' == 2146)
	quietly replace `varlist'=1  if (`tmpisko' == 2147)
	quietly replace `varlist'=2  if (`tmpisko' == 2148)
	quietly replace `varlist'=1  if (`tmpisko' == 2149)
	quietly replace `varlist'=1  if (`tmpisko' == 2200)
	quietly replace `varlist'=1  if (`tmpisko' == 2210)
	quietly replace `varlist'=1  if (`tmpisko' == 2211)
	quietly replace `varlist'=1  if (`tmpisko' == 2212)
	quietly replace `varlist'=1  if (`tmpisko' == 2213)
	quietly replace `varlist'=1  if (`tmpisko' == 2220)
	quietly replace `varlist'=1  if (`tmpisko' == 2221)
	quietly replace `varlist'=1  if (`tmpisko' == 2222)
	quietly replace `varlist'=1  if (`tmpisko' == 2223)
	quietly replace `varlist'=1  if (`tmpisko' == 2224)
	quietly replace `varlist'=1  if (`tmpisko' == 2229)
	quietly replace `varlist'=2  if (`tmpisko' == 2230)
	quietly replace `varlist'=2  if (`tmpisko' == 2300)
	quietly replace `varlist'=1  if (`tmpisko' == 2310)
	quietly replace `varlist'=2  if (`tmpisko' == 2320)
	quietly replace `varlist'=2  if (`tmpisko' == 2321)
	quietly replace `varlist'=2  if (`tmpisko' == 2322)
	quietly replace `varlist'=2  if (`tmpisko' == 2323)
	quietly replace `varlist'=2  if (`tmpisko' == 2330)
	quietly replace `varlist'=2  if (`tmpisko' == 2331)
	quietly replace `varlist'=2  if (`tmpisko' == 2332)
	quietly replace `varlist'=2  if (`tmpisko' == 2340)
	quietly replace `varlist'=1  if (`tmpisko' == 2350)
	quietly replace `varlist'=1  if (`tmpisko' == 2351)
	quietly replace `varlist'=1  if (`tmpisko' == 2352)
	quietly replace `varlist'=2  if (`tmpisko' == 2359)
	quietly replace `varlist'=1  if (`tmpisko' == 2400)
	quietly replace `varlist'=2  if (`tmpisko' == 2410)
	quietly replace `varlist'=1  if (`tmpisko' == 2411)
	quietly replace `varlist'=2  if (`tmpisko' == 2412)
	quietly replace `varlist'=2  if (`tmpisko' == 2419)
	quietly replace `varlist'=1  if (`tmpisko' == 2420)
	quietly replace `varlist'=1  if (`tmpisko' == 2421)
	quietly replace `varlist'=1  if (`tmpisko' == 2422)
	quietly replace `varlist'=1  if (`tmpisko' == 2429)
	quietly replace `varlist'=2  if (`tmpisko' == 2430)
	quietly replace `varlist'=2  if (`tmpisko' == 2431)
	quietly replace `varlist'=2  if (`tmpisko' == 2432)
	quietly replace `varlist'=1  if (`tmpisko' == 2440)
	quietly replace `varlist'=1  if (`tmpisko' == 2441)
	quietly replace `varlist'=1  if (`tmpisko' == 2442)
	quietly replace `varlist'=1  if (`tmpisko' == 2443)
	quietly replace `varlist'=2  if (`tmpisko' == 2444)
	quietly replace `varlist'=1  if (`tmpisko' == 2445)
	quietly replace `varlist'=2  if (`tmpisko' == 2446)
	quietly replace `varlist'=2  if (`tmpisko' == 2450)
	quietly replace `varlist'=2  if (`tmpisko' == 2451)
	quietly replace `varlist'=2  if (`tmpisko' == 2452)
	quietly replace `varlist'=2  if (`tmpisko' == 2453)
	quietly replace `varlist'=2  if (`tmpisko' == 2454)
	quietly replace `varlist'=2  if (`tmpisko' == 2455)
	quietly replace `varlist'=2  if (`tmpisko' == 2460)
	quietly replace `varlist'=2  if (`tmpisko' == 3000)
	quietly replace `varlist'=2  if (`tmpisko' == 3100)
	quietly replace `varlist'=2  if (`tmpisko' == 3110)
	quietly replace `varlist'=2  if (`tmpisko' == 3111)
	quietly replace `varlist'=2  if (`tmpisko' == 3112)
	quietly replace `varlist'=2  if (`tmpisko' == 3113)
	quietly replace `varlist'=2  if (`tmpisko' == 3114)
	quietly replace `varlist'=2  if (`tmpisko' == 3115)
	quietly replace `varlist'=2  if (`tmpisko' == 3116)
	quietly replace `varlist'=2  if (`tmpisko' == 3117)
	quietly replace `varlist'=2  if (`tmpisko' == 3118)
	quietly replace `varlist'=2  if (`tmpisko' == 3119)
	quietly replace `varlist'=2  if (`tmpisko' == 3120)
	quietly replace `varlist'=2  if (`tmpisko' == 3121)
	quietly replace `varlist'=2  if (`tmpisko' == 3122)
	quietly replace `varlist'=2  if (`tmpisko' == 3123)
	quietly replace `varlist'=2  if (`tmpisko' == 3130)
	quietly replace `varlist'=2  if (`tmpisko' == 3131)
	quietly replace `varlist'=2  if (`tmpisko' == 3132)
	quietly replace `varlist'=2  if (`tmpisko' == 3133)
	quietly replace `varlist'=2  if (`tmpisko' == 3139)
	quietly replace `varlist'=2  if (`tmpisko' == 3140)
	quietly replace `varlist'=2  if (`tmpisko' == 3141)
	quietly replace `varlist'=2  if (`tmpisko' == 3142)
	quietly replace `varlist'=1  if (`tmpisko' == 3143)
	quietly replace `varlist'=1  if (`tmpisko' == 3144)
	quietly replace `varlist'=2  if (`tmpisko' == 3145)
	quietly replace `varlist'=2  if (`tmpisko' == 3150)
	quietly replace `varlist'=2  if (`tmpisko' == 3151)
	quietly replace `varlist'=2  if (`tmpisko' == 3152)
	quietly replace `varlist'=2  if (`tmpisko' == 3200)
	quietly replace `varlist'=2  if (`tmpisko' == 3210)
	quietly replace `varlist'=2  if (`tmpisko' == 3211)
	quietly replace `varlist'=2  if (`tmpisko' == 3212)
	quietly replace `varlist'=2  if (`tmpisko' == 3213)
	quietly replace `varlist'=2  if (`tmpisko' == 3220)
	quietly replace `varlist'=2  if (`tmpisko' == 3221)
	quietly replace `varlist'=2  if (`tmpisko' == 3222)
	quietly replace `varlist'=2  if (`tmpisko' == 3223)
	quietly replace `varlist'=2  if (`tmpisko' == 3224)
	quietly replace `varlist'=2  if (`tmpisko' == 3225)
	quietly replace `varlist'=2  if (`tmpisko' == 3226)
	quietly replace `varlist'=2  if (`tmpisko' == 3227)
	quietly replace `varlist'=2  if (`tmpisko' == 3228)
	quietly replace `varlist'=2  if (`tmpisko' == 3229)
	quietly replace `varlist'=3  if (`tmpisko' == 3230)
	quietly replace `varlist'=3  if (`tmpisko' == 3231)
	quietly replace `varlist'=3  if (`tmpisko' == 3232)
	quietly replace `varlist'=2  if (`tmpisko' == 3240)
	quietly replace `varlist'=2  if (`tmpisko' == 3241)
	quietly replace `varlist'=2  if (`tmpisko' == 3242)
	quietly replace `varlist'=3  if (`tmpisko' == 3300)
	quietly replace `varlist'=3  if (`tmpisko' == 3310)
	quietly replace `varlist'=3  if (`tmpisko' == 3320)
	quietly replace `varlist'=3  if (`tmpisko' == 3330)
	quietly replace `varlist'=3  if (`tmpisko' == 3340)
	quietly replace `varlist'=2  if (`tmpisko' == 3400)
	quietly replace `varlist'=2  if (`tmpisko' == 3410)
	quietly replace `varlist'=2  if (`tmpisko' == 3411)
	quietly replace `varlist'=2  if (`tmpisko' == 3412)
	quietly replace `varlist'=2  if (`tmpisko' == 3413)
	quietly replace `varlist'=2  if (`tmpisko' == 3414)
	quietly replace `varlist'=2  if (`tmpisko' == 3415)
	quietly replace `varlist'=2  if (`tmpisko' == 3416)
	quietly replace `varlist'=2  if (`tmpisko' == 3417)
	quietly replace `varlist'=2  if (`tmpisko' == 3419)
	quietly replace `varlist'=2  if (`tmpisko' == 3420)
	quietly replace `varlist'=2  if (`tmpisko' == 3421)
	quietly replace `varlist'=2  if (`tmpisko' == 3422)
	quietly replace `varlist'=2  if (`tmpisko' == 3423)
	quietly replace `varlist'=2  if (`tmpisko' == 3429)
	quietly replace `varlist'=3  if (`tmpisko' == 3430)
	quietly replace `varlist'=2  if (`tmpisko' == 3431)
	quietly replace `varlist'=2  if (`tmpisko' == 3432)
	quietly replace `varlist'=3  if (`tmpisko' == 3433)
	quietly replace `varlist'=2  if (`tmpisko' == 3434)
	quietly replace `varlist'=3  if (`tmpisko' == 3439)
	quietly replace `varlist'=2  if (`tmpisko' == 3440)
	quietly replace `varlist'=2  if (`tmpisko' == 3441)
	quietly replace `varlist'=2  if (`tmpisko' == 3442)
	quietly replace `varlist'=2  if (`tmpisko' == 3443)
	quietly replace `varlist'=2  if (`tmpisko' == 3444)
	quietly replace `varlist'=2  if (`tmpisko' == 3449)
	quietly replace `varlist'=2  if (`tmpisko' == 3450)
	quietly replace `varlist'=2  if (`tmpisko' == 3451)
	quietly replace `varlist'=7  if (`tmpisko' == 3452)
	quietly replace `varlist'=3  if (`tmpisko' == 3460)
	quietly replace `varlist'=2  if (`tmpisko' == 3470)
	quietly replace `varlist'=2  if (`tmpisko' == 3471)
	quietly replace `varlist'=2  if (`tmpisko' == 3472)
	quietly replace `varlist'=2  if (`tmpisko' == 3473)
	quietly replace `varlist'=2  if (`tmpisko' == 3474)
	quietly replace `varlist'=2  if (`tmpisko' == 3475)
	quietly replace `varlist'=3  if (`tmpisko' == 3480)
	quietly replace `varlist'=3  if (`tmpisko' == 4000)
	quietly replace `varlist'=3  if (`tmpisko' == 4100)
	quietly replace `varlist'=3  if (`tmpisko' == 4110)
	quietly replace `varlist'=3  if (`tmpisko' == 4111)
	quietly replace `varlist'=3  if (`tmpisko' == 4112)
	quietly replace `varlist'=3  if (`tmpisko' == 4113)
	quietly replace `varlist'=3  if (`tmpisko' == 4114)
	quietly replace `varlist'=3  if (`tmpisko' == 4115)
	quietly replace `varlist'=3  if (`tmpisko' == 4120)
	quietly replace `varlist'=3  if (`tmpisko' == 4121)
	quietly replace `varlist'=3  if (`tmpisko' == 4122)
	quietly replace `varlist'=3  if (`tmpisko' == 4130)
	quietly replace `varlist'=3  if (`tmpisko' == 4131)
	quietly replace `varlist'=3  if (`tmpisko' == 4132)
	quietly replace `varlist'=3  if (`tmpisko' == 4133)
	quietly replace `varlist'=3  if (`tmpisko' == 4140)
	quietly replace `varlist'=3  if (`tmpisko' == 4141)
	quietly replace `varlist'=9  if (`tmpisko' == 4142)
	quietly replace `varlist'=3  if (`tmpisko' == 4143)
	quietly replace `varlist'=3  if (`tmpisko' == 4144)
	quietly replace `varlist'=3  if (`tmpisko' == 4190)
	quietly replace `varlist'=3  if (`tmpisko' == 4200)
	quietly replace `varlist'=3  if (`tmpisko' == 4210)
	quietly replace `varlist'=3  if (`tmpisko' == 4211)
	quietly replace `varlist'=3  if (`tmpisko' == 4212)
	quietly replace `varlist'=3  if (`tmpisko' == 4213)
	quietly replace `varlist'=3  if (`tmpisko' == 4214)
	quietly replace `varlist'=3  if (`tmpisko' == 4215)
	quietly replace `varlist'=3  if (`tmpisko' == 4220)
	quietly replace `varlist'=3  if (`tmpisko' == 4221)
	quietly replace `varlist'=3  if (`tmpisko' == 4222)
	quietly replace `varlist'=3  if (`tmpisko' == 4223)
	quietly replace `varlist'=3  if (`tmpisko' == 5000)
	quietly replace `varlist'=3  if (`tmpisko' == 5100)
	quietly replace `varlist'=3  if (`tmpisko' == 5110)
	quietly replace `varlist'=3  if (`tmpisko' == 5111)
	quietly replace `varlist'=3  if (`tmpisko' == 5112)
	quietly replace `varlist'=3  if (`tmpisko' == 5113)
	quietly replace `varlist'=3  if (`tmpisko' == 5120)
	quietly replace `varlist'=2  if (`tmpisko' == 5121)
	quietly replace `varlist'=8  if (`tmpisko' == 5122)
	quietly replace `varlist'=9  if (`tmpisko' == 5123)
	quietly replace `varlist'=9  if (`tmpisko' == 5130)
	quietly replace `varlist'=3  if (`tmpisko' == 5131)
	quietly replace `varlist'=9  if (`tmpisko' == 5132)
	quietly replace `varlist'=3  if (`tmpisko' == 5133)
	quietly replace `varlist'=9  if (`tmpisko' == 5139)
	quietly replace `varlist'=8  if (`tmpisko' == 5140)
	quietly replace `varlist'=8  if (`tmpisko' == 5141)
	quietly replace `varlist'=9  if (`tmpisko' == 5142)
	quietly replace `varlist'=8  if (`tmpisko' == 5143)
	quietly replace `varlist'=9  if (`tmpisko' == 5149)
	quietly replace `varlist'=2  if (`tmpisko' == 5150)
	quietly replace `varlist'=2  if (`tmpisko' == 5151)
	quietly replace `varlist'=2  if (`tmpisko' == 5152)
	quietly replace `varlist'=9  if (`tmpisko' == 5160)
	quietly replace `varlist'=8  if (`tmpisko' == 5161)
	quietly replace `varlist'=8  if (`tmpisko' == 5162)
	quietly replace `varlist'=9  if (`tmpisko' == 5163)
	quietly replace `varlist'=8  if (`tmpisko' == 5164)
	quietly replace `varlist'=9  if (`tmpisko' == 5169)
	quietly replace `varlist'=3  if (`tmpisko' == 5200)
	quietly replace `varlist'=3  if (`tmpisko' == 5210)
	quietly replace `varlist'=3  if (`tmpisko' == 5220)
	quietly replace `varlist'=3  if (`tmpisko' == 5230)
	quietly replace `varlist'=10 if (`tmpisko' == 6000)
	quietly replace `varlist'=10 if (`tmpisko' == 6100)
	quietly replace `varlist'=10 if (`tmpisko' == 6110)
	quietly replace `varlist'=10 if (`tmpisko' == 6111)
	quietly replace `varlist'=10 if (`tmpisko' == 6112)
	quietly replace `varlist'=10 if (`tmpisko' == 6113)
	quietly replace `varlist'=10 if (`tmpisko' == 6114)
	quietly replace `varlist'=10 if (`tmpisko' == 6120)
	quietly replace `varlist'=10 if (`tmpisko' == 6121)
	quietly replace `varlist'=10 if (`tmpisko' == 6122)
	quietly replace `varlist'=10 if (`tmpisko' == 6123)
	quietly replace `varlist'=10 if (`tmpisko' == 6124)
	quietly replace `varlist'=10 if (`tmpisko' == 6129)
	quietly replace `varlist'=10 if (`tmpisko' == 6130)
	quietly replace `varlist'=11 if (`tmpisko' == 6131)
	quietly replace `varlist'=11 if (`tmpisko' == 6132)
	quietly replace `varlist'=11 if (`tmpisko' == 6133)
	quietly replace `varlist'=10 if (`tmpisko' == 6134)
	quietly replace `varlist'=10 if (`tmpisko' == 6140)
	quietly replace `varlist'=10 if (`tmpisko' == 6141)
	quietly replace `varlist'=10 if (`tmpisko' == 6142)
	quietly replace `varlist'=10 if (`tmpisko' == 6150)
	quietly replace `varlist'=10 if (`tmpisko' == 6151)
	quietly replace `varlist'=10 if (`tmpisko' == 6152)
	quietly replace `varlist'=10 if (`tmpisko' == 6153)
	quietly replace `varlist'=10 if (`tmpisko' == 6154)
	quietly replace `varlist'=11 if (`tmpisko' == 6200)
	quietly replace `varlist'=11 if (`tmpisko' == 6210)
	quietly replace `varlist'=8  if (`tmpisko' == 7000)
	quietly replace `varlist'=8  if (`tmpisko' == 7100)
	quietly replace `varlist'=8  if (`tmpisko' == 7110)
	quietly replace `varlist'=8  if (`tmpisko' == 7111)
	quietly replace `varlist'=8  if (`tmpisko' == 7112)
	quietly replace `varlist'=8  if (`tmpisko' == 7113)
	quietly replace `varlist'=8  if (`tmpisko' == 7120)
	quietly replace `varlist'=9  if (`tmpisko' == 7121)
	quietly replace `varlist'=9  if (`tmpisko' == 7122)
	quietly replace `varlist'=9  if (`tmpisko' == 7123)
	quietly replace `varlist'=8  if (`tmpisko' == 7124)
	quietly replace `varlist'=8  if (`tmpisko' == 7129)
	quietly replace `varlist'=8  if (`tmpisko' == 7130)
	quietly replace `varlist'=9  if (`tmpisko' == 7131)
	quietly replace `varlist'=8  if (`tmpisko' == 7132)
	quietly replace `varlist'=8  if (`tmpisko' == 7133)
	quietly replace `varlist'=8  if (`tmpisko' == 7134)
	quietly replace `varlist'=9  if (`tmpisko' == 7135)
	quietly replace `varlist'=8  if (`tmpisko' == 7136)
	quietly replace `varlist'=8  if (`tmpisko' == 7137)
	quietly replace `varlist'=8  if (`tmpisko' == 7140)
	quietly replace `varlist'=8  if (`tmpisko' == 7141)
	quietly replace `varlist'=9  if (`tmpisko' == 7142)
	quietly replace `varlist'=9  if (`tmpisko' == 7143)
	quietly replace `varlist'=8  if (`tmpisko' == 7200)
	quietly replace `varlist'=8  if (`tmpisko' == 7210)
	quietly replace `varlist'=8  if (`tmpisko' == 7211)
	quietly replace `varlist'=8  if (`tmpisko' == 7212)
	quietly replace `varlist'=8  if (`tmpisko' == 7213)
	quietly replace `varlist'=8  if (`tmpisko' == 7214)
	quietly replace `varlist'=8  if (`tmpisko' == 7215)
	quietly replace `varlist'=8  if (`tmpisko' == 7216)
	quietly replace `varlist'=8  if (`tmpisko' == 7220)
	quietly replace `varlist'=8  if (`tmpisko' == 7221)
	quietly replace `varlist'=8  if (`tmpisko' == 7222)
	quietly replace `varlist'=8  if (`tmpisko' == 7223)
	quietly replace `varlist'=8  if (`tmpisko' == 7224)
	quietly replace `varlist'=8  if (`tmpisko' == 7230)
	quietly replace `varlist'=8  if (`tmpisko' == 7231)
	quietly replace `varlist'=8  if (`tmpisko' == 7232)
	quietly replace `varlist'=8  if (`tmpisko' == 7233)
	quietly replace `varlist'=9  if (`tmpisko' == 7234)
	quietly replace `varlist'=8  if (`tmpisko' == 7240)
	quietly replace `varlist'=8  if (`tmpisko' == 7241)
	quietly replace `varlist'=8  if (`tmpisko' == 7242)
	quietly replace `varlist'=8  if (`tmpisko' == 7243)
	quietly replace `varlist'=8  if (`tmpisko' == 7244)
	quietly replace `varlist'=8  if (`tmpisko' == 7245)
	quietly replace `varlist'=8  if (`tmpisko' == 7300)
	quietly replace `varlist'=8  if (`tmpisko' == 7310)
	quietly replace `varlist'=8  if (`tmpisko' == 7311)
	quietly replace `varlist'=8  if (`tmpisko' == 7312)
	quietly replace `varlist'=8  if (`tmpisko' == 7313)
	quietly replace `varlist'=9  if (`tmpisko' == 7320)
	quietly replace `varlist'=9  if (`tmpisko' == 7321)
	quietly replace `varlist'=9  if (`tmpisko' == 7322)
	quietly replace `varlist'=8  if (`tmpisko' == 7323)
	quietly replace `varlist'=8  if (`tmpisko' == 7324)
	quietly replace `varlist'=9  if (`tmpisko' == 7330)
	quietly replace `varlist'=9  if (`tmpisko' == 7331)
	quietly replace `varlist'=9  if (`tmpisko' == 7332)
	quietly replace `varlist'=8  if (`tmpisko' == 7340)
	quietly replace `varlist'=8  if (`tmpisko' == 7341)
	quietly replace `varlist'=8  if (`tmpisko' == 7342)
	quietly replace `varlist'=8  if (`tmpisko' == 7343)
	quietly replace `varlist'=8  if (`tmpisko' == 7344)
	quietly replace `varlist'=8  if (`tmpisko' == 7345)
	quietly replace `varlist'=8  if (`tmpisko' == 7346)
	quietly replace `varlist'=8  if (`tmpisko' == 7400)
	quietly replace `varlist'=8  if (`tmpisko' == 7410)
	quietly replace `varlist'=8  if (`tmpisko' == 7411)
	quietly replace `varlist'=8  if (`tmpisko' == 7412)
	quietly replace `varlist'=8  if (`tmpisko' == 7413)
	quietly replace `varlist'=8  if (`tmpisko' == 7414)
	quietly replace `varlist'=8  if (`tmpisko' == 7415)
	quietly replace `varlist'=8  if (`tmpisko' == 7416)
	quietly replace `varlist'=8  if (`tmpisko' == 7420)
	quietly replace `varlist'=9  if (`tmpisko' == 7421)
	quietly replace `varlist'=8  if (`tmpisko' == 7422)
	quietly replace `varlist'=8  if (`tmpisko' == 7423)
	quietly replace `varlist'=9  if (`tmpisko' == 7424)
	quietly replace `varlist'=8  if (`tmpisko' == 7430)
	quietly replace `varlist'=9  if (`tmpisko' == 7431)
	quietly replace `varlist'=9  if (`tmpisko' == 7432)
	quietly replace `varlist'=8  if (`tmpisko' == 7433)
	quietly replace `varlist'=8  if (`tmpisko' == 7434)
	quietly replace `varlist'=8  if (`tmpisko' == 7435)
	quietly replace `varlist'=8  if (`tmpisko' == 7436)
	quietly replace `varlist'=8  if (`tmpisko' == 7437)
	quietly replace `varlist'=8  if (`tmpisko' == 7440)
	quietly replace `varlist'=8  if (`tmpisko' == 7441)
	quietly replace `varlist'=8  if (`tmpisko' == 7442)
	quietly replace `varlist'=8  if (`tmpisko' == 7500)
	quietly replace `varlist'=7  if (`tmpisko' == 7510)
	quietly replace `varlist'=8  if (`tmpisko' == 7520)
	quietly replace `varlist'=9  if (`tmpisko' == 7530)
	quietly replace `varlist'=9  if (`tmpisko' == 8000)
	quietly replace `varlist'=9  if (`tmpisko' == 8100)
	quietly replace `varlist'=8  if (`tmpisko' == 8110)
	quietly replace `varlist'=8  if (`tmpisko' == 8111)
	quietly replace `varlist'=8  if (`tmpisko' == 8112)
	quietly replace `varlist'=8  if (`tmpisko' == 8113)
	quietly replace `varlist'=8  if (`tmpisko' == 8120)
	quietly replace `varlist'=8  if (`tmpisko' == 8121)
	quietly replace `varlist'=8  if (`tmpisko' == 8122)
	quietly replace `varlist'=8  if (`tmpisko' == 8123)
	quietly replace `varlist'=8  if (`tmpisko' == 8124)
	quietly replace `varlist'=9  if (`tmpisko' == 8130)
	quietly replace `varlist'=9  if (`tmpisko' == 8131)
	quietly replace `varlist'=9  if (`tmpisko' == 8139)
	quietly replace `varlist'=9  if (`tmpisko' == 8140)
	quietly replace `varlist'=9  if (`tmpisko' == 8141)
	quietly replace `varlist'=9  if (`tmpisko' == 8142)
	quietly replace `varlist'=9  if (`tmpisko' == 8143)
	quietly replace `varlist'=8  if (`tmpisko' == 8150)
	quietly replace `varlist'=8  if (`tmpisko' == 8151)
	quietly replace `varlist'=8  if (`tmpisko' == 8152)
	quietly replace `varlist'=8  if (`tmpisko' == 8153)
	quietly replace `varlist'=8  if (`tmpisko' == 8154)
	quietly replace `varlist'=8  if (`tmpisko' == 8155)
	quietly replace `varlist'=8  if (`tmpisko' == 8159)
	quietly replace `varlist'=8  if (`tmpisko' == 8160)
	quietly replace `varlist'=8  if (`tmpisko' == 8161)
	quietly replace `varlist'=8  if (`tmpisko' == 8162)
	quietly replace `varlist'=8  if (`tmpisko' == 8163)
	quietly replace `varlist'=8  if (`tmpisko' == 8170)
	quietly replace `varlist'=8  if (`tmpisko' == 8171)
	quietly replace `varlist'=8  if (`tmpisko' == 8172)
	quietly replace `varlist'=9  if (`tmpisko' == 8200)
	quietly replace `varlist'=8  if (`tmpisko' == 8210)
	quietly replace `varlist'=8  if (`tmpisko' == 8211)
	quietly replace `varlist'=9  if (`tmpisko' == 8212)
	quietly replace `varlist'=9  if (`tmpisko' == 8220)
	quietly replace `varlist'=9  if (`tmpisko' == 8221)
	quietly replace `varlist'=9  if (`tmpisko' == 8222)
	quietly replace `varlist'=9  if (`tmpisko' == 8223)
	quietly replace `varlist'=9  if (`tmpisko' == 8224)
	quietly replace `varlist'=9  if (`tmpisko' == 8229)
	quietly replace `varlist'=9  if (`tmpisko' == 8230)
	quietly replace `varlist'=9  if (`tmpisko' == 8231)
	quietly replace `varlist'=9  if (`tmpisko' == 8232)
	quietly replace `varlist'=9  if (`tmpisko' == 8240)
	quietly replace `varlist'=9  if (`tmpisko' == 8250)
	quietly replace `varlist'=9  if (`tmpisko' == 8251)
	quietly replace `varlist'=9  if (`tmpisko' == 8252)
	quietly replace `varlist'=9  if (`tmpisko' == 8253)
	quietly replace `varlist'=9  if (`tmpisko' == 8260)
	quietly replace `varlist'=9  if (`tmpisko' == 8261)
	quietly replace `varlist'=9  if (`tmpisko' == 8262)
	quietly replace `varlist'=9  if (`tmpisko' == 8263)
	quietly replace `varlist'=9  if (`tmpisko' == 8264)
	quietly replace `varlist'=9  if (`tmpisko' == 8265)
	quietly replace `varlist'=9  if (`tmpisko' == 8266)
	quietly replace `varlist'=9  if (`tmpisko' == 8269)
	quietly replace `varlist'=9  if (`tmpisko' == 8270)
	quietly replace `varlist'=9  if (`tmpisko' == 8271)
	quietly replace `varlist'=9  if (`tmpisko' == 8272)
	quietly replace `varlist'=9  if (`tmpisko' == 8273)
	quietly replace `varlist'=9  if (`tmpisko' == 8274)
	quietly replace `varlist'=9  if (`tmpisko' == 8275)
	quietly replace `varlist'=9  if (`tmpisko' == 8276)
	quietly replace `varlist'=9  if (`tmpisko' == 8277)
	quietly replace `varlist'=9  if (`tmpisko' == 8278)
	quietly replace `varlist'=9  if (`tmpisko' == 8279)
	quietly replace `varlist'=9  if (`tmpisko' == 8280)
	quietly replace `varlist'=9  if (`tmpisko' == 8281)
	quietly replace `varlist'=9  if (`tmpisko' == 8282)
	quietly replace `varlist'=9  if (`tmpisko' == 8283)
	quietly replace `varlist'=9  if (`tmpisko' == 8284)
	quietly replace `varlist'=9  if (`tmpisko' == 8285)
	quietly replace `varlist'=9  if (`tmpisko' == 8286)
	quietly replace `varlist'=9  if (`tmpisko' == 8290)
	quietly replace `varlist'=9  if (`tmpisko' == 8300)
	quietly replace `varlist'=9  if (`tmpisko' == 8310)
	quietly replace `varlist'=8  if (`tmpisko' == 8311)
	quietly replace `varlist'=9  if (`tmpisko' == 8312)
	quietly replace `varlist'=9  if (`tmpisko' == 8320)
	quietly replace `varlist'=9  if (`tmpisko' == 8321)
	quietly replace `varlist'=9  if (`tmpisko' == 8322)
	quietly replace `varlist'=9  if (`tmpisko' == 8323)
	quietly replace `varlist'=9  if (`tmpisko' == 8324)
	quietly replace `varlist'=9  if (`tmpisko' == 8330)
	quietly replace `varlist'=10 if (`tmpisko' == 8331)
	quietly replace `varlist'=8  if (`tmpisko' == 8332)
	quietly replace `varlist'=8  if (`tmpisko' == 8333)
	quietly replace `varlist'=9  if (`tmpisko' == 8334)
	quietly replace `varlist'=9  if (`tmpisko' == 8340)
	quietly replace `varlist'=9  if (`tmpisko' == 8400)
	quietly replace `varlist'=9  if (`tmpisko' == 9000)
	quietly replace `varlist'=3  if (`tmpisko' == 9100)
	quietly replace `varlist'=3  if (`tmpisko' == 9110)
	quietly replace `varlist'=3  if (`tmpisko' == 9111)
	quietly replace `varlist'=3  if (`tmpisko' == 9112)
	quietly replace `varlist'=3  if (`tmpisko' == 9113)
	quietly replace `varlist'=9  if (`tmpisko' == 9120)
	quietly replace `varlist'=9  if (`tmpisko' == 9130)
	quietly replace `varlist'=9  if (`tmpisko' == 9131)
	quietly replace `varlist'=9  if (`tmpisko' == 9132)
	quietly replace `varlist'=9  if (`tmpisko' == 9133)
	quietly replace `varlist'=9  if (`tmpisko' == 9140)
	quietly replace `varlist'=9  if (`tmpisko' == 9141)
	quietly replace `varlist'=9  if (`tmpisko' == 9142)
	quietly replace `varlist'=9  if (`tmpisko' == 9150)
	quietly replace `varlist'=9  if (`tmpisko' == 9151)
	quietly replace `varlist'=9  if (`tmpisko' == 9152)
	quietly replace `varlist'=9  if (`tmpisko' == 9153)
	quietly replace `varlist'=9  if (`tmpisko' == 9160)
	quietly replace `varlist'=9  if (`tmpisko' == 9161)
	quietly replace `varlist'=9  if (`tmpisko' == 9162)
	quietly replace `varlist'=9  if (`tmpisko' == 9200)
	quietly replace `varlist'=10 if (`tmpisko' == 9210)
	quietly replace `varlist'=10 if (`tmpisko' == 9211)
	quietly replace `varlist'=10 if (`tmpisko' == 9212)
	quietly replace `varlist'=10 if (`tmpisko' == 9213)
	quietly replace `varlist'=9  if (`tmpisko' == 9300)
	quietly replace `varlist'=9  if (`tmpisko' == 9310)
	quietly replace `varlist'=9  if (`tmpisko' == 9311)
	quietly replace `varlist'=9  if (`tmpisko' == 9312)
	quietly replace `varlist'=9  if (`tmpisko' == 9313)
	quietly replace `varlist'=9  if (`tmpisko' == 9320)
	quietly replace `varlist'=9  if (`tmpisko' == 9321)
	quietly replace `varlist'=9  if (`tmpisko' == 9322)
	quietly replace `varlist'=9  if (`tmpisko' == 9330)
	quietly replace `varlist'=9  if (`tmpisko' == 9331)
	quietly replace `varlist'=9  if (`tmpisko' == 9332)
	quietly replace `varlist'=9  if (`tmpisko' == 9333)

	* Start of ISCOEGP.INC section
	* `p' codes promotability of certain occupations
	tempvar p
	quietly gen `p'=.
	quietly replace `p'=1 if (`tmpisko' >= 1000 & `tmpisko' <= 9299)
	* `d' codes degradability of certain occupations
	tempvar d
	quietly gen `d'=.
	#delimit ;
	quietly replace `d'=1 if ((`tmpisko' >= 1300 & `tmpisko' <= 1319) |
	                          (`tmpisko' >= 3400 & `tmpisko' <= 3439) |
	                          (`tmpisko' >= 4000 & `tmpisko' <= 5230));

	quietly replace `varlist'=2  if  (`varlist' == 3 & `tmpsv' >= 1 & `tmpsv' ~= .);
	quietly replace `varlist'=4  if ((`varlist' == 3 | `varlist' == 2) &
	                                  `sempl' == 1 &
	                                  `d' == 1);
	quietly replace `varlist'=5  if ((`varlist' >= 7 & `varlist' <= 9) &
	                                  `sempl' == 1 &
	                                  `p' == 1);
	quietly replace `varlist'=7  if (`varlist' == 8  & `tmpsv' >= 1 & `tmpsv' ~= .);
	quietly replace `varlist'=11 if (`varlist' == 10 & `sempl' == 1);
	quietly replace `varlist'=5  if (`varlist' == 4 & `tmpsv' < 1);
	quietly replace `varlist'=4 if  (`varlist' == 5 & `tmpsv' >= 1 & `tmpsv' ~= .);
	quietly replace `varlist'=1 if  ((`varlist' == 2 | `varlist' == 3 | `varlist' == 4) &
	                                  `tmpsv' >= 10 & `tmpsv' ~= .);

	capture label define egp10
	  1 "higher controllers"
	  2 "lo controllers"
	  3 "routine nonmanual"
	  4 "sempl with emp"
	  5 "sempl without empl"
	  7 "manual supervisor"
	  8 "skilled manual"
	  9 "semi-unskilld manual"
	 10 "farm labor"
	 11 "selfempl farm";
	#delimit cr
	label values `varlist' egp10
end