THAI 1970 CENSUS $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ORIGINAL RAW DATA FILES (unmatched) : ------------------------------------- [XL=] VOL=SER=TU0189 [tape dsn=THAILAND70.COPY1] DSN=THAI70.CLEAN,LABEL=(1,SL,EXPDT=98000) DCB=(RECFM=FB,LRECL=135,BLKSIZE=32400) or [XL=] VOL=SER=TU8452 [tape dsn=THAILAND70.COPY2] DSN=THAI70.CLEAN,LABEL=(1,SL,EXPDT=98000) DCB=(RECFM=FB,LRECL=135,BLKSIZE=32400) STANDARD (mother & kids match) FILES: ------------------------------------- [XL=] VOL=SER=TU0217 [tape dsn=THAILAND80.COPY1] DSN=XTHA7STD.DAT,LABEL=(2,SL,EXPDT=98000) DCB=(RECFM=FB,LRECL=200,BLKSIZE=32600) [Unweighted N=184,926] or: [XL=] VOL=SER=T00697 [tape dsn=THAILAND80.COPY2] DSN=XTHA7STD.DAT,LABEL=(2,SL,EXPDT=98000) DCB=(RECFM=FB,LRECL=200,BLKSIZE=32600) [Unweighted N=184,926] $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ THAILAND, 1970 CENSUS. ---------------------- INPUT STANDARD LOCATION, as FILE substring of (output) raw data rec VARIABLE DESCRIPTION LOCATION ------------ ---------------------------------------- -------- WIFE INFORMATION: ------------------------------------------------------------- YH(F(7)) Computed Household Number 1- 7 (1,1) Region 8- 8 (2,2) Changwat (Province) 9- 10 (4,2) Amphoe (District) 11- 12 (6,2) Municipal/Non-municipal 13- 14 (8,2) Enumeration District number 15- 16 (10,1) Split Enumeration District or Block 17- 17 (11,1) Sanitary District 18- 18 (12,3) Household number 19- 21 (125,11) Weighting factor 22- 32 (26,2) Age 33- 34 (20,2) Relationship to HH head 35- 36 ' '||(64,1) Marital status 37- 38 '999' Ethnicity (N.A.) 39- 41 ' '||(28,1) Residence Status 42- 44 ' '||(29,1) Religion 45- 47 ' '||(30,2) Citizenship 48- 50 (41,2) School grade attended 51- 52 ' '||(43,2) Highest grade completed 53- 55 '99' Education, other info (N.A.) 56- 57 ' '||(40,1) Literacy 58- 59 '99' School attendance (N.A.) 60- 61 '99' Migrant status (N.A.) 62- 63 ' '||(32,2) Place of birth 64- 67 '9999' Place of birth, other info (N.A.) 68- 71 ' '||(37,2) Previous residence, Changwat 72- 75 ' '||(39,1) Previous residence, Municipality/Non 76- 79 ' '||(36,1) Length of residence 80- 81 '9999' Residence/Migration, other info (N.A.) 82- 85 '99' Age at marriage (N.A.) 86- 87 '99' Duration of marriage, years (N.A.) 88- 89 '99' Number of times married (N.A.) 90- 91 '99' Duration of marriage, months (N.A.) 92- 93 '99' Contraception: Ever use (N.A.) 94- 95 '99' Contraception: Current use (N.A.) 96- 97 (65,2) Children ever born, Total 98- 99 '99' children ever born, male (N.A.) 100-101 '99' children ever born, female (N.A.) 102-103 (67,2) Live children, Total 104-105 '99' live children, male (N.A.) 106-107 '99' live children, female (N.A.) 108-109 '99' Number of children who died (N.A.) 110-111 '99' Date of last birth, month (N.A.) 112-113 '99' Date of last birth, year (N.A.) 114-115 '99' Last born is still alive (N.A.) 116-117 '99' Number of births last year (N.A.) 118-119 ' '||(74,3) Main occupation last year 120-123 ' '||(77,2) Main industry last year 124-127 (69,3) Occupation last week 128-130 (72,2) Reason for not working 131-132 (79,1) Work status, past year's occup. 133-133 (84,3) Recode of Main occupation 134-136 (87,3) Recode of last week's occupation 137-139 HUSBAND INFORMATION: ------------------------------------------------------------- 0,1 (f(1)) Computed: Husband match=1, else=0 140-140 (26,2) Age, husband 141-142 (41,2) School grade attended, husband 143-144 ' '||(43,2) Highest grade completed, husband 145-147 '99' Education, other info, husband (N.A.) 148-149 ' '||(40,1) Literacy, husband 150-151 '99' School attendance, husband (N.A.) 152-153 ' '||(74,3) Main occupation last year, husband 154-157 ' '||(77,2) Main industry last year, husband 158-161 (69,3) Occupation last week, husband 162-164 (72,2) Reason for not working, husband 165-166 (79,1) Work status, past year occup., husband 167-167 (84,3) Recode of Main occupation, husband 168-170 (87,3) Last week occupation recode, husband 171-173 OWN (matched) CHILDREN INFORMATION: ------------------------------------------------------------- OWN(f(1)) Computed: Number of matched own kids 174-174 K1(26,2) Age of matched own kid No.1 175-175 K2(26,2) Age of matched own kid No.2 176-176 K3(26,2) Age of matched own kid No.3 177-177 K4(26,2) Age of matched own kid No.4 178-178 K5(26,2) Age of matched own kid No.5 179-179 k6(26,2) Age of matched own kid no.6 180-180 K7(26,2) Age of matched own kid No.7 181-181 K8(26,2) Age of matched own kid No.8 182-182 CHILDREN (in Household) WITH NO MOTHER-MATCH: ------------------------------------------------------------- OTH(f(2)) Computed: Number of unmatched kids in HH 183-184 K 1(26,2) Age of unmatched kid in HH, No. 1 185-185 K 2(26,2) Age of unmatched kid in HH, No. 2 186-186 K 3(26,2) Age of unmatched kid in HH, No. 3 187-187 K 4(26,2) Age of unmatched kid in HH, No. 4 188-188 K 5(26,2) Age of unmatched kid in HH, No. 5 189-189 K 6(26,2) Age of unmatched kid in HH, No. 6 190-190 K 7(26,2) Age of unmatched kid in HH, No. 7 191-191 K 8(26,2) Age of unmatched kid in HH, No. 8 192-192 K 9(26,2) Age of unmatched kid in HH, No. 9 193-193 K10(26,2) Age of unmatched kid in HH, No.10 194-194 K11(26,2) Age of unmatched kid in HH, No.11 195-195 K12(26,2) Age of unmatched kid in HH, No.12 196-196 K13(26,2) Age of unmatched kid in HH, No.13 197-197 K14(26,2) Age of unmatched kid in HH, No.14 198-198 K15(26,2) Age of unmatched kid in HH, No.15 199-199 K16(26,2) Age of unmatched kid in HH, No.16 200-200 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ // EXEC SETUP,V=TU0217,RING=YES // EXEC PLIXCLG,TIME.GO=60 MATCH: procedure options (main); dcl T bit init('1'B), (TH,TN) fixed dec(7)init(0), (NXT,OLD,KA) char(135)var init(''), LV char(10)init('0123456789'), (RL,SX,AG,MR,LC,IC,IH,IX,I,J,K,L) fixed dec(7)init(0), CI(300)char(2)var, HI(300)char(33)var, XI(300)char(200)var, (CR(300),HR(300),XR(300),CH(300))fixed dec(7); CR,HR,XR,CH=0; CI=''; HI=''; XI=''; /* initial block */ on endfile(INF)goto Z; on error goto NR; /* conditn block */ do while (T); /* main loop */ NR: OLD=NXT; get file(INF)edit(NXT)(col(1),a(135)); if substr(OLD,1,15)^=substr(NXT,1,15) then do; if IX>0 then do; do J=1 to IX; /* MATCH HUSBANDS AND WIVES */ if substr(XI(J),38,1)='2' then do; do K=1 to IH; if ((XR(J)=1&HR(K)=2)|(XR(J)=2&HR(K)=1) |((XR(J)=3|XR(J)=10)&HR(K)=4) |(XR(J)=4&(HR(K)=3|HR(K)=10)) |(XR(J)>4&XR(J)^=10&(XR(J)=HR(K)))) then do; XI(J)=XI(J)||'1'||HI(K);HR(K)=0;goto NH; end; end; end; NH: if length(XI(J))=139 then XI(J)=XI(J)||'0'; K=length(XI(J));do L=K to 172; XI(J)=XI(J)||' ';end; end; do J=1 to IX; KA=''; /* MATCH CHILDREN AND MOTHERS */ if substr(XI(J),38,1)^='1' then do; do K=1 to IC; if length(KA)<8&length(KA)0&length(KA)<9 then KA=KA||CI(J); end; XI(1)=XI(1)||' '||substr(LV,1+length(KA),1)||KA; do J=1 to IX; /* WRITE */ put file(OUT)edit(XI(J))(col(1),a(200)); end; end; TH=TH+1; IC,IH,IX,RL,AG,SX,MR,LC=0; /* RESET */ CR,HR,XR,CH=0;CI='';HI='';XI='';KA=''; TN=0; end; if substr(NXT,15,1)='1' then do; get string(NXT)edit(RL,SX,AG)(x(19),f(2),f(1),x(2),f(3)); if AG>10 then get string(NXT)edit(MR,LC)(x(63),f(1),x(2),f(2)); else do; MR=0; LC=0; end; end; if TN<300 & (RL>0&RL<12&RL^=9) & ((AG>=0&AG<5)| (SX=1&AG>14&AG<100&MR=2)|(SX=2&AG>14&AG<50&MR<7)) then do; TN=TN+1; if AG<5 /* KEEP NEEDED CHILD INFO */ then do; IC=IC+1;CR(IC)=RL;CI(IC)=substr(NXT,27,1); end; else if SX=1 /* KEEP NEEDED HUSB. INFO */ then do; IH=IH+1; HR(IH)=RL; HI(IH)=substr(NXT,26,2) /* Age */ ||substr(NXT,41,2) /* v24 */ ||' '||substr(NXT,43,2)||' ' /* v25,NA */ ||' '||substr(NXT,40,1)||' ' /* lit,sc */ ||' '||substr(NXT,74,3) /* occup */ ||' '||substr(NXT,77,2) /* indus */ ||substr(NXT,69,3)||substr(NXT,72,2) /* v46,47 */ ||substr(NXT,79,1) /* v50 */ ||substr(NXT,87,3)||substr(NXT,84,3); /* v54,53 */ end; else /* KEEP NEEDED WOMAN INFO */ do; if LC<0|LC>30 then LC=0; IX=IX+1; XR(IX)=RL; CH(IX)=LC; put string(XI(IX))edit(TH)(f(7)); XI(IX)=XI(IX)||substr(NXT,1,14) /* AreaVars */ ||substr(NXT,125,11) /* Weight */ ||substr(NXT,26,2)||substr(NXT,20,2) /* AG,RL */ ||' '||substr(NXT,64,1) /* marst */ ||' '||' '||substr(NXT,28,1) /*eth,ResSta*/ ||' '||substr(NXT,29,1) /* relig */ ||' '||substr(NXT,30,2) /* Citiz */ ||substr(NXT,41,2) /* v24 */ ||' '||substr(NXT,43,2)||' ' /* v25,NA*/ ||' '||substr(NXT,40,1)||' ' /* lit,sc*/ ||' '||' '||substr(NXT,32,2)||' ' /*mig,br1-2*/ ||' '||substr(NXT,37,2) /*prvRes1*/ ||' '||substr(NXT,39,1) /*prvRes2*/ ||' '||substr(NXT,36,1)||' ' /* DurRes,OthMigNA */ ||' ' /*AgeMar,DurMar,OthMar1-2,bc1-2*/ ||substr(NXT,65,2)||' ' /*bc1-2,ceb1-3*/ ||substr(NXT,67,2)||' ' /*lch1-3,Oth*/ ||' '||substr(NXT,74,3) /* occup */ ||' '||substr(NXT,77,2) /* indus */ ||substr(NXT,69,3)||substr(NXT,72,2) /* v46,47 */ ||substr(NXT,79,1) /* v50 */ ||substr(NXT,87,3)||substr(NXT,84,3); /* v54,53 */ end;end; end; /* end main loop */ Z:end MATCH; //GO.INF DD UNIT=TAPE9,DSN=THAI70.CLEAN,DISP=(OLD,KEEP), // VOL=SER=TU0189,LABEL=(1,SL), // DCB=(RECFM=FB,LRECL=135,BLKSIZE=32400) //GO.OUT DD UNIT=TAPE9,DSN=XTHA7STD.DAT,DISP=(NEW,KEEP), // VOL=SER=TU0217,LABEL=(2,SL,EXPDT=98000), // DCB=(RECFM=FB,LRECL=200,BLKSIZE=32600) // EXEC FMTLBLS,V=TU0217 // $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$