/* Construction of a 16-class and 8-class schema for the person-file of the Swiss Household Panel 1999 Daniel Oesch, daniel.oesch@unil.ch, University of Lausanne, 21 October 2009 */ %let path = D:\SHP-Data2\SHP-Data-W1-W10-SAS ; /* this should be where the folders containing the SHP data files are contained */ /* this assumes that the data files are saved in folders of the form W1_1999\SAS etc. */ libname CDw1 "&path.\W1_1999" ; /* creates the waves all library */ libname CDwa "&path.\SHP-Data-WA-SAS" ; * 1. Merge differents files ; proc sort data = cdw1.shp99_p_user out = workfile1 ; by idpers ; run ; Proc sort data = CDwa.SHP_LJ out= workfile2 ; by idpers ; run ; data workfile3 (keep = idpers idspou99 idhous99 status99 weip99ts relarp99 wstat99 occupa99 noga2m99 p99w31 noga2l__ p__w114 p99w114 is4maj99 xis4ma99 is4laj99 xis4la99 educat99 ljyy isco_mainjob99 isco_lastjob99 isco_respondent99) ; merge workfile1 (in = a) workfile2 ; by idpers ; if a ; * if status99 = 0 ; p99w114 = P__w114 ; /* not sure how this is used later */ is4laj99 = is4laj__ ; xis4la99 = xis4la__ ; isco_mainjob99 = is4maj99 ; if isco_mainjob99 < 0 then isco_mainjob99 = xis4ma99 ; isco_lastjob99 = is4laj99 ; if isco_lastjob99 < 0 then isco_lastjob99 = xis4la99 ; /* 2.2 add information from last job for people without job at present */ isco_respondent99 = isco_mainjob99 ; if isco_respondent99 < 0 then isco_respondent99 = isco_lastjob99 ; /* if no main job try last job */ run ; /* construct the formats neccesary for the recoding and for the formatting done later */ %macro f16to8() ; %do i = 1 %to 8 ; %let n = %eval(2*&i - 1) ; &n , %eval(&n+1) = "&i" %end ; %mend f16to8 ; /* constructs a range from the first argument to the last */ %macro range(fv, lv) ; &fv %do i = %eval(&fv + 1) %to &lv ; , &i %end ; %mend range ; proc format ; value educat_recode -6 - 3 = '1' 4 - 6 = '2' 7-10 = '3' ; value educat 1 = "Less than upper secondary education" 2 = "Upper secondary education" 3 = "Tertiary education" ; value selfem_recode -3 - -1 = '1' 1 = '2' 2, 3 = '3' 4 - 7 = '4' ; value selfem 1 = "Not self-employed" 2 = "Self-empl without employees" 3 = "Self-empl with 1-9 employees" 4 = "Self-empl with 10 or more" ; value f16toeight -9 = "-9" %f16to8 ; value class16l 1 = "1.00 Large employers (10 or more employees)" 2 = "2.00 Self-employed professionals" 3 = "3.00 Small business owners with 1-9 employees" 4 = "4.00 Small business owners without employees" 5 = "5.00 Managers and administrators" 6 = "6.00 Associate managers and administrators" 7 = "7.00 Skilled clerks" 8 = "8.00 Routine clerks" 9 = "9.00 Technical experts" 10 = "10.00 Technicians" 11 = "11.00 Skilled craft workers" 12 = "12.00 Routine operatives" 13 = "13.00 Socio-cultural professionals" 14 = "14.00 Socio-cultural semi-professionals" 15 = "15.00 Skilled service workers" 16 = "16.00 Routine service workers" ; value class8l 1 = "1.00 Self-employed professionals and large employers" 2 = "2.00 Small business owners" 3 = "3.00 (Associate) managers and administrators" 4 = "4.00 Office clerks" 5 = "5.00 Technical professionals and technicians" 6 = "6.00 Production workers" 7 = "7.00 Socio-cultural (semi-)professionals" 8 = "8.00 Service workers" ; run ; data workfile4 ; merge workfile3 (rename = (isco_respondent99 = isco_all99 educat99 = educat_all99 /*this rename is to keep the codes as close as possible to the others */)); label educ_level99 = "niveau education" selfem_level99 = 'nbre employés' classe16 = 'classification de classe en 16' classe8 = 'classification de classe en 8'; format educ_level99 educat. selfem_level99 selfem. class16 class16l. class8 class8l.; /* 3.3 Take self-employment from las job */ selfem_all99 = p99w31 ; if isco_mainjob99 < 0 & isco_lastjob99 > 0 then selfem_all99 = p99w114 ; /* ************* 3.4 Take sector employment from last job *********************************************** */ noga_all99 = noga2m99 ; if (isco_mainjob99<0 and isco_lastjob99>0) then noga_all99= noga2l__ ; /* 4. recode variables used to construct class variables */ /* 4.1 recode education into 3 levels */ educ_level99 = input(put(educat_all99, educat_recode.), 8.) ; /* 4.1 recode self-employment / employer */ selfem_level99 = input(put(selfem_all99, selfem_recode.), 8.) ; /* ************** 5. Recode classes to the 15-class schema********************************************************* */ /* ************** 5.1 Allocate self-employed to schema************************************************************* */ class16 = -9; if selfem_level99=4 then class16 = 1; if (selfem_level99= 2 | selfem_level99 = 3) and (isco_all99 >= 2000 and isco_all99 <= 2470) then class16 = 2; if (selfem_level99 = 3) and ((isco_all99 >= 1000 & isco_all99 <= 1999) or (isco_all99 >= 3000 & isco_all99 <= 9330)) then class16 =3; if (selfem_level99 = 2) and ((isco_all99 >= 1000 & isco_all99 <= 1999) or (isco_all99 >= 3000 and isco_all99 <=9330)) then class16 =4; /* ******* 5.2 Allocate employed managers and professionals (ISCO 1000-2470) to the schema. */ if (selfem_level99=1) and (isco_all99 >= 110 & isco_all99 <= 1239) then class16=5 ; if (selfem_level99=1) and (isco_all99 >= 1300 & isco_all99 <= 1320) then class16=6 ; if (selfem_level99=1) and (isco_all99 >= 2100 & isco_all99 <= 2213) then class16=9; if (selfem_level99=1) and (isco_all99 >= 2220 & isco_all99 <= 2321) then class16=13; if (selfem_level99=1) and (isco_all99 >= 2330 & isco_all99 <= 2332) then class16=14; if (selfem_level99=1) and (isco_all99 >= 2340 & isco_all99 <= 2359) then class16=13; if (selfem_level99=1) and (isco_all99 >= 2410 & isco_all99 <= 2429) then class16=5; if (selfem_level99=1) and (isco_all99 >= 2430 & isco_all99 <= 2432) then class16=14 ; if (selfem_level99=1) and (isco_all99= 2440) then class16=13; if (selfem_level99=1) and (isco_all99=2441) then class16=5; if (selfem_level99=1) and (isco_all99 >= 2442 & isco_all99 <= 2443) then class16=13 ; if (selfem_level99=1) and (isco_all99=2444) then class16=14 ; if (selfem_level99=1) and (isco_all99=2445) then class16=13 ; if (selfem_level99=1) and (isco_all99 >= 2446 & isco_all99 <= 2450) then class16=14 ; if (selfem_level99=1) and (isco_all99=2451) then class16=13 ; if (selfem_level99=1) and (isco_all99 >= 2452 & isco_all99 <= 2455) then class16=14; if (selfem_level99=1) and (isco_all99=2460) then class16=13 ; if (selfem_level99=1) and (isco_all99=2470) then class16=5 ; /* ****** 5.3 Allocate employed associate managers and semi-professionals (ISCO 3000) to the schema. */ if selfem_level99=1 and (isco_all99 >= 3100 & isco_all99 <= 3152) then class16=10 ; if selfem_level99=1 and (isco_all99 = 3200) then class16=14; if selfem_level99=1 and (isco_all99 >= 3210 & isco_all99 <= 3213) then class16=10 ; if selfem_level99=1 and (isco_all99 >= 3220 & isco_all99 <=3224) then class16=14; if selfem_level99=1 and (isco_all99=3225) then class16=15; if selfem_level99=1 and (isco_all99=3226) then class16=14 ; if selfem_level99=1 and (isco_all99 >= 3227 & isco_all99 <= 3228) then class16=15 ; if selfem_level99=1 and (isco_all99 >= 3229 & isco_all99 <= 3340) then class16=14; if selfem_level99=1 and (isco_all99 >= 3400 & isco_all99 <= 3433) then class16=6 ; if selfem_level99=1 and (isco_all99=3434) then class16=10 ; if selfem_level99=1 and (isco_all99 >= 3440 & isco_all99 <= 3450) then class16=6 ; if selfem_level99=1 and (isco_all99 >= 3460 & isco_all99 <= 3472) then class16=14 ; if selfem_level99=1 and (isco_all99 >= 3473 & isco_all99 <= 3475) then class16=15 ; if selfem_level99=1 and (isco_all99=3480) then class16=14 ; /* ***** 5.4 Allocate specific occupations to the schema. */ /* *****Professional military forces (isco 100) to associate managers . */ if (selfem_level99=1 and isco_all99=100) then class16=6 ; /* *****Locomotive engine drivers to technicians. */ if (selfem_level99=1) and (isco_all99 = 8310 or isco_all99 = 8311) then class16=10 ; /* *****Police officers to associate managers. */ if (selfem_level99=1 and isco_all99=5162) then class16=6; /* ******Bus and tram drivers to skilled and routine service workers. */ if (selfem_level99=1 and isco_all99=8323) then class16=15; /* ****** 5.5 Allocate intermediate occupations to the schema (ISCO 4000-8340) and correct for skilled/unskilled (with/without upper secondary education). */ if selfem_level99=1 and (educ_level99 ~=1) and (isco_all99 >= 4000 & isco_all99 <= 4223) then class16=7; if selfem_level99=1 and educ_level99 =1 and (isco_all99 >= 4000 & isco_all99 <= 4223) then class16=8; if selfem_level99=1 and educ_level99~=1 and (isco_all99 =5160 | isco_all99 = 5169) then class16=15; if selfem_level99=1 and educ_level99=1 and (isco_all99 =5160 | isco_all99 = 5169) then class16=16; if selfem_level99=1 and (isco_all99 = 5161 | isco_all99 = 5163) then class16=7; if selfem_level99=1 and educ_level99~=1 and (isco_all99 >= 5000 & isco_all99<=5132) then class16=15; if selfem_level99=1 and educ_level99=1 and (isco_all99 >= 5000 & isco_all99 <= 5132) then class16=16 ; if selfem_level99=1 and (isco_all99= 5133 | isco_all99=5139) then class16=16; if selfem_level99=1 and educ_level99~=1 and (isco_all99 = 5140 | isco_all99= 5141 | isco_all99= 5143) then class16=15; if selfem_level99=1 and educ_level99=1 and (isco_all99 = 5140 | isco_all99= 5141 | isco_all99= 5143) then class16=16; if selfem_level99=1 and (isco_all99= 5142 | isco_all99= 5149) then class16=16; if selfem_level99=1 and educ_level99~=1 and (isco_all99 >= 5200 & isco_all99 <= 5220) then class16=15; if selfem_level99=1 and educ_level99=1 and (isco_all99 >= 5200 & isco_all99 <= 5220) then class16=16 ; /* (note: there was a typo above: 5000 instead of 5200 for then class16 = 16). */ if selfem_level99=1 and educ_level99~=1 and (isco_all99 >= 6000 & isco_all99 <= 6154) then class16=11; if selfem_level99=1 and educ_level99=1 and (isco_all99 >= 6000 & isco_all99 <= 6154) then class16=12; if selfem_level99=1 and educ_level99~=1 and (isco_all99 >= 7000 & isco_all99<= 7442) then class16=11 ; if selfem_level99=1 and educ_level99=1 and (isco_all99 >= 7000 & isco_all99 <=7442) then class16=12 ; if selfem_level99=1 and educ_level99~=1 and (isco_all99 >= 8000 & isco_all99<= 8279) then class16=11; if selfem_level99=1 and educ_level99 =1 and (isco_all99 >= 8000 & isco_all99<= 8279) then class16=12; if selfem_level99=1 and (isco_all99 >= 8280 & isco_all99<= 8300) then class16=12; if selfem_level99=1 and educ_level99~=1 and isco_all99=8312 then class16=11 ; if selfem_level99=1 and educ_level99=1 and isco_all99=8312 then class16=12 ; if selfem_level99=1 and (isco_all99 >= 8320 & isco_all99 <= 8322) then class16=12; if selfem_level99=1 and educ_level99~=1 and (isco_all99 >= 8323 & isco_all99<= 8324) then class16=11; if selfem_level99=1 and educ_level99=1 and (isco_all99 >= 8323 & isco_all99 <= 8324) then class16=12 ; if selfem_level99=1 and isco_all99=8330 then class16=12; if selfem_level99=1 and educ_level99~=1 and (isco_all99 >= 8331 & isco_all99 <= 8340) then class16=11; if selfem_level99=1 and educ_level99=1 and (isco_all99 >= 8331 & isco_all99 <= 8340) then class16=12 ; /* ******* 5.5 Allocate elementary occupations (ISCO 9000-9330 ). */ if selfem_level99=1 and (isco_all99 >= 9100 & isco_all99<= 9152) then class16=12; if selfem_level99=1 and (isco_all99 >= 9153 & isco_all99<= 9330) then class16=16; if selfem_level99=1 and isco_all99=9000 and noga_all99 in (%range(1,6)) then class16=12; if selfem_level99=1 and isco_all99=9000 and (noga_all99= -3 | noga_all99= -2 | (noga_all99 in (%range(7,17))) ) then class16=12; /* (note: do not get why the distinction, it is coded 12 in both cases??). */ /* ********* 5.6 Occupations impossible to allocate to a given class. */ if (selfem_level99=1 and isco_all99=2000) then class16=-9; if (selfem_level99=1 and isco_all99=3000) then class16=-9; class8 = input(put(class16, f16toeight.), 8.) ; run ; proc sort data = workfile4 out = workfile5 (keep = idpers idspou99 class16 class8); by idspou99 ; run ; proc sort data = workfile5 (keep = idpers class16 class8 rename=(idpers = idspou99 class16= class16_p class8 = class8_p)) out = partner ; by idspou99 ; run ; proc freq data = workfile5 ; table class16 class8 ; run ; data outputfile (keep = idpers class16 class8 class16_p class8_p) ; merge workfile5 (in = a) partner ; by idspou99 ; if a ; if class16 < 0 & class16_p >= 0 then class16 = class16_p ; if class8 < 0 & class8_p >= 0 then class8 = class8_p ; run ; ods pdf file = "D:\directory\filename.pdf" ; proc freq data = outputfile ; table class16 class8 class16_p class8_p / missing ; run ; ods pdf close ;