***HARMONIZATION CANADIAN DATA 2015*** ** Be aware that it is a light diary** clear all use "\\ad.ucl.ac.uk\homee\qtnvmve\Documents\marga\CANADA\original\original\data\main.dta" sort PUMFI * COUNTRY* gen str2 country="CA" *SURVEY* gen survey=2015 *SWAVE* gen swave=0 *MSAMP* gen msamp=0 ***HLID*** gen hldid=0 *PERSID* gen persid=PUMFID *ID* gen id=1 * There is only one diary per participant* * PARTNTID1* gen parntid1=-9 * PARTNTID2* gen parntid2=-9 * PARTID* gen partid=-9 * There is not sposuse or partner* *MONTH* gen month=-9 *YEAR* gen year=2015 *DIARY* gen diary=1 *HOUSETYPE* gen hhtype=. replace hhtype=1 if LIVARR11==1 & HSDSIZEC==1 replace hhtype=1 if LIVARR11==12 & HSDSIZEC==1 replace hhtype=2 if LIVARR11==2 & HSDSIZEC==2 replace hhtype=3 if (LIVARR11==2 |LIVARR11==3|LIVARR11==4|LIVARR11==5) & HSDSIZEC>2 replace hhtype=4 if LIVARR11==6|LIVARR11==7|LIVARR11==8|LIVARR11==9|LIVARR11==10|LIVARR11==11 *** HSDSIZEC*** gen hhldsize=HSDSIZEC *** NCHILD*** rename CHH0014C nchild *Important are those are younger than 14 years old*** **Just three or more** * AGEKIDX* gen agekidx=AGECXRYG replace agekidx=1 if AGECXRYG==1 replace agekidx=2 if AGECXRYG==2 |AGECXRYG==3 replace agekidx=3 if AGECXRYG==4 replace agekidx=4 if AGECXRYG==5|AGECXRYG==6 replace agekidx=-7 if AGECXRYG==96|AGECXRYG==99 ** readmefile** ** AGEKID2** gen agekid2=-9 *INCOME* gen incorig=. replace incorig=HHINCG1 label values incorig HHINCG1 recode incorig (98=.)(99=.) xtile income=incorig, nq(4) recode income (2 3=2) (4=3) (. =-8) ***OWNHOME*** gen ownhome=-9 **** ok**** * URBAN*** gen urban=. replace urban=1 if LUC_RS==1 replace urban=2 if LUC_RS==2|LUC_RS==3 **( numer 3 is price edard island that do not explain very good >>..thehe is not much population and i add it to rural )*** * COMPUTER* gen computer=-9 * VEHICLE* gen vehicle=-9 *** SEX*** rename SEX sex *** AGE*** gen age=. replace age=19 if AGEGR10==1 replace age = 29 if AGEGR10==2 replace age = 39 if AGEGR10==3 replace age = 49 if AGEGR10==4 replace age = 59 if AGEGR10==5 replace age = 69 if AGEGR10==6 replace age = 75 if AGEGR10==7 * FAMSTAT* gen famstat=-8 replace famstat=0 if (age>=18 & age<40) & nchild==0 replace famstat=0 if famstat==-8 & (age>=18 & age<40) replace famstat=1 if age>=18 & nchild>0 & agekidx==1/**/ replace famstat=3 if age>=40 & nchild==0 replace famstat=2 if age>=18 & nchild>0 & (agekidx==2 | agekidx==3) replace famstat=4 if age<18 & (LIVARR11==8 | LIVARR11==9) replace famstat=5 if age<18 & (LIVARR11!=8 & LIVARR11!=9) * RELREFP* gen relrefp=1 * CIVSTAT* gen civstat=PHSDFLG ** COHAB** gen cohab=-7 replace cohab=0 if civstat==1& MARSTAT==1 replace cohab=1 if civstat==1& MARSTAT==2 **EMPSTAST* gen empstat= . replace empstat=1 if ACT7DAYS==1 replace empstat=4 if ACT7DAYS!=1 replace empstat=-8 if ACT7DAYS==97|ACT7DAYS==98|ACT7DAYS==99 *EMP* gen emp=. replace emp=1 if ACT7DAYS==1 replace emp=0 if ACT7DAYS!=1 replace emp=-8 if ACT7DAYS==97|ACT7DAYS==98|ACT7DAYS==99 * UMEMP* gen unemp=. replace unemp=0 if ACT7DAYS==1 replace unemp=1 if ACT7DAYS!=1 replace unemp=-8 if ACT7DAYS==97|ACT7DAYS==98|ACT7DAYS==99 *STUDENT* gen student=. replace student=1 if ACT7DAYS==3 replace student=0 if ACT7DAYS!=3 replace student =-8 if ACT7DAYS==97|ACT7DAYS==98|ACT7DAYS==99 * RETIRED* gen retired=. replace retired=1 if ACT7DAYS==5 replace retired=0 if ACT7DAYS!=5 replace retired =-8 if ACT7DAYS==97|ACT7DAYS==98|ACT7DAYS==99 * EMSPSP* gen empsp =MAP_110C replace empsp=4 if MAP_110C==2|MAP_110C==3|MAP_110C==4|MAP_110C==5|MAP_110C==6|MAP_110C==7|MAP_110C==8|MAP_110C==9 replace empsp=-7 if MAP_110C==96 replace empsp=-8 if MAP_110C==97|MAP_110C==98|MAP_110C==99 ***WORKHRS** gen workhrs=WHWD140C *** EMPINCLM*** gen empinclm =INCG1 ***Income - Personal income group (before tax)= i thing that is national*** * ISCO1* gen isco1=-9 /** replace isco=0 replace isco=1 replace isco=2 if NAIC12CW==9|NAIC12CW==10||NAIC12CW==11|NAIC12CW==12 replace isco=3 replace isco=4 replace isco=5 if NAIC12CW==5|NAIC12CW==6|NAIC12CW==7|NAIC12CW==8||NAIC12CW==13 replace isco=6 if NAIC12CW==1 |NAIC12CW==2 replace isco=7 replace isco=8 replace isco=8 if NAIC12CW==5 replace isco=9 if NAIC12CW==3|NAIC12CW==4 ***/ ** very limited variable, reconsider to include it**** * SECTOR* gen sector=. replace sector =1 if NAIC12CW==20 replace sector =2 if NAIC12CW!=20 replace sector=-7 if NAIC12CW==96 replace sector=-8 if NAIC12CW==97|NAIC12CW==98|NAIC12CW==99 *** EDCAT*** gen edcat=. replace edcat =1 if EHG_ALL==1 replace edcat =2 if EHG_ALL==2|EHG_ALL==3|EHG_ALL==4 replace edcat =3 if EHG_ALL==5|EHG_ALL==6|EHG_ALL==7 replace edcat=-8 if EHG_ALL==97|EHG_ALL==98|EHG_ALL==99 *** EDUCA** rename EHG_ALL educa replace educa=-8 if educa==97|educa==98|educa==99 *** RUSHED*** gen rushed=. replace rushed=0 if GTU_110==6 replace rushed=1 if GTU_110==3 | GTU_110==4|GTU_110==5 replace rushed=2 if GTU_110==1 | GTU_110==2 replace rushed=-8 if GTU_110==97| GTU_110==98 * HEALTH* gen health= SRH_110 replace health=0 if SRH_110==5 replace health=1 if SRH_110==4 replace health=2 if SRH_110==3 replace health=3 if SRH_110==2|SRH_110==1 replace health=-8 if SRH_110==7|SRH_110==8|SRH_110==9 *** CARER*** gen carer=-9 ***DISAB*** gen disab = DDIS_FL replace disab=0 if DDIS_FL==2 replace disab=-8 if DDIS_FL ==7|DDIS_FL ==8|DDIS_FL ==9 *** ANIMAL*** gen animal=-9 **SINGPAR** gen singpar=-9 *** CITIZEN*** gen citizen=DCIT replace citizen=1 if DCIT==1|DCIT==2|DCIT==3|DCIT==4 replace citizen=0 if DCIT==5 replace citizen=-8 if DCIT==6 ** WHEREBORN*** gen wherborn=BRTHCAN replace wherborn=-8 if BRTHCAN==7|BRTHCAN==8|BRTHCAN==9 sort PUMFID gen epnum=TOTEPISO save "\\ad.ucl.ac.uk\homee\qtnvmve\Documents\marga\CANADA\background_ca2015.dta", replace *****EPISODE FILE FOR THE CANADIAN 2015** clear all use "\\ad.ucl.ac.uk\homee\qtnvmve\Documents\marga\CANADA\original\original\data\episode.dta" *DAY* gen day=DDAY ***** gen cday=-9 ***TIME*** gen time=DURATION ***CLOCKST*** destring STARTIME, gen(clockst) gen clockst=STARTIME replace clockst=clockst/100 format clockst %9.2fc ** error in the data******* sort PUMFID STARTMIN by PUMFID : egen number = min(STARTMIN) gen new_START = STARTMIN- number gen new_END = ENDMIN -number rename new_START start rename new_END end drop STARTMIN ENDMIN *** EPINO*** gen epnum= EPINO ***MAIN*** ** MAIN 69** ***time variables*** *MAIN1: IMPUTED PERSONAL OR HOUSEHOLD CARE gen main=-9 *MAIN2: SLEEP AND NAPS forval i= 1/82{ replace main=2 if TUI_01==1 } **of sleeping, napping, resting, relaxing, sick in bed** *MAIN3: IMPUTED SLEEP *MAIN4: WASH, DRESS, CARE FOR SELF forval i= 1/82 { replace main=4 if TUI_01==2|TUI_01==4 } ***Personal hygiene; praying, spiritual activities, meditating; sexual activities, **Taking blood pressure, sugar level, medication, treatment** *MAIN5: MEALS AT WORK OR SCHOOL forval i= 1/82 { replace main= 5 if (TUI_01==6)&( LOCATION==300|LOCATION==301) } ***the total occurrences of eating or drinking - Meals, snacks, drinks** *MAIN6: OTHER MEALS OR SNACKS forval i= 1/82 { replace main= 5 if (TUI_01==6)&( LOCATION!=300|LOCATION!=301) } **the total occurrences of eating or drinking - Meals, snacks, drinks* *MAIN7: PAID WORK - MAIN JOB (NOT AT HOME) forval i= 1/82 { replace main=7 if (TUI_01==8|TUI_01==11)&( LOCATION!=300) } **the total occurrences of paid work** **the total occurrences of paid training,* *MAIN8: PAID WORK AT HOME forval i= 1/82 { replace main=7 if (TUI_01==8|TUI_01==11|TUI_01==10)&( LOCATION==300) } *MAIN9: SECOND OR OTHER JOB NOT AT HOME forval i= 1/82 { replace main=9 if (TUI_01==10)&( LOCATION!=300) } *total occurence of other income generating activities** *MAIN10: UNPAID WORK TO GENERATE HOUSEHOLD INCOME forval i= 1/82 { replace main=14 if TUI_01==40 } **the total occurrences of selling goods or services*** *MAIN11: TRAVEL AS A PART OF WORK *MAIN12: WORK BREAKS forval i= 1/82 { replace main= 12 if (TUI_01==12)&( LOCATION==300|LOCATION==301) *** } ***the total occurrences of break(s) or lunch,*** *MAIN13: OTHER TIME AT WORKPLACE *MAIN14: LOOK FOR WORK forval i= 1/82 { replace main=14 if TUI_01==9 } **the total occurrences of looking for paid work** *MAIN15: REGULAR SCHOOLING, EDUCATION forval i= 1/82 { replace main=15 if TUI_01==13 | TUI_01==14 } **the total occurrences of schooling full time/part time*** *MAIN16: HOMEWORK forval i= 1/82{ replace main=16 if TUI_01==15 } ***the total occurrences of homework or studying,*** *MAIN17: LEISURE/OTHER EDUCATION TRAINING forval i= 1/82 { replace main=17 if TUI_01==16 } **schooling full time/part time - Online** **the total occurrences of self-development or leisure and special interest classes,*** *MAIN18: FOOD PREPARATION, COOK forval i= 1/82 { replace main=18 if TUI_01==5|TUI_01==17 } ****the total occurrences of meal, lunch or snack preparation*** **the total occurrences of preserving foods - Baking, freezing, sealing, packing foods*** *MAIN19: SET TABLE, WASH/PUT AWAY DISHES *MAIN20: CLEANING forval i= 1/82{ replace main=20 if TUI_01==18|TUI_01==19 } * Indoor house cleaning, dish washing, tidying** **taking out garbage, recycling, compost, unpacking goods** *MAIN21: LAUNDRY, IRONING, CLOTHING REPAIR forval i= 1/82 { replace main=21 if TUI_01==20 } ***the total occurrences of laundry, ironing, folding, sewing, shoe care** *MAIN22: MAINTAIN HOME / VEHICLE forval i= 1/82 { replace main=22 if TUI_01==25|TUI_01==24|TUI_01==21 } ***planting (picking), maintaining, cleaning garden, caring for house plants** ***outdoor maintenance - Car repair, ground maintenance, snow removal, cutting grass** *MAIN23: OTHER DOMESTIC WORK forval i= 1/82 { replace main=23 if TUI_01==22|TUI_01==23 } ***organizing, planning, paying bills* **unpacking groceries, packing and unpacking luggage for travel and/or boxes for a move** ***repair, painting or renovation,** *MAIN24: PURCHASE GOODS forval i= 1/82 { replace main=24 if TUI_01==37 } *** shopping for or buying goods - Gasoline, groceries, clothing, car*** *MAIN25: CONSUME PERSONAL CARE SERVICES forval i= 1/82 { replace main=25 if TUI_01==38|TUI_01==3 } **shopping for services - Legal services, financial services, vehicle maintenance*** ***the total occurrences of health professional visit(s), consultation*** *MAIN26: CONSUME OTHER SERVICES forval i= 1/82{ replace main=26 if TUI_01==39 } ***researching for goods or services**8 *MAIN27: PET CARE (NOT WALK DOG) forval i= 1/82{ replace main=27 if TUI_01==26 } ****the total occurrences of pet care - Feeding, walking, grooming, playing*** *MAIN28: PHYSICAL, MEDICAL CHILD CARE forval i= 1/82 { replace main=28 if TUI_01==29 } ** 27: caring for a child less than 15, personal care, getting ready for school, supervising homework, reading, playing, reprimanding educational, emotional help* ** 29: childen between 15-17 helping with homeworkm playing, reprimanding, educational, personal care, getting ready for school** *MAIN29: TEACH, HELP WITH HOMEWORK *MAIN30: READ TO, TALK OR PLAY WITH CHILDREN forval i= 1/82 { replace main=30 if TUI_01==27 } *MAIN31: SUPERVISE, ACCOMPANY, OTHER CHILD CARE forval i= 1/82 { replace main=31 if TUI_01==28| TUI_01==30| TUI_01==33 } ****caring for a child less than 15 Accompanying to or from school, bus stop, sports, activities, parent school meetings or appointments** *** caring for a teenager from your household, 15 to 17 - Accompanying to or from school, bus stop, sports, activities, parent school meetings or appointments** ***caring for a child from another household - Supervision, feeding, talking, accompanying,*** *MAIN32: ADULT CARE forval i= 1/82{ replace main=32 if TUI_01==31| TUI_01==32| TUI_01==34| TUI_01==35 } **caring for an adult from your household - Washing, dressing, caregiving, financial management** **the total occurrences of caring for an adult from your household - Accompanying to or from appointments, shopping** ***of caring for an adult from another household - Preparing meals, cleaning, caregiving, financial and household,** *MAIN33: VOLUNTARY, CIVIC ORGANIZATIONAL ACT forval i= 1/82 { replace main=33 if TUI_01==36| TUI_01==43| TUI_01==44| TUI_01==46 } ****the total occurrences of helping relatives, friends, neighbours, acquaintances (Excluding caregiving)*** ***of organizational activities, ** ***/ the total occurrences of voluntary work,** ***civic participation - Voting, Jury duty*** *MAIN34: WORSHIP AND RELIGION forval i= 1/82{ replace main=34 if TUI_01==45 } ****the total occurrences of religious activities*** *MAIN35: GENERAL OUT-OF-HOME LEISURE *MAIN36: ATTENDING SPORTING EVENT forval i= 1/82 { replace main=36 if TUI_01==54 } ****the total occurrences of attending sporting events*** * **MAIN37: CINEMA, THEATRE, OPERA, CONCERT forval i= 1/82 { replace main=37 if TUI_01==53 } ***of attending cinema, exhibitions, library, concerts, theatre, entertainment events** *MAIN38: OTHER PUBLIC EVENT, VENUE forval i= 1/82 { replace main=38 if TUI_01==55 } *** the total occurrences of visiting museums, art galleries, heritage sites, zoos, observatories**** *MAIN39: RESTAURANT, CAFE, BAR, PUB *MAIN40: PARTY, SOCIAL EVENT, GAMBLING forval i= 1/82 { replace main=38 if TUI_01==41 } ***the total occurrences of socializing or communicating - In person, *** *MAIN41: IMPUTED TIME AWAY FROM HOME ********************************************* *MAIN42: GENERAL SPORT OR EXERCISE forval i= 1/82 { replace main=38 if TUI_01==47|TUI_01==48|TUI_01==49|TUI_01==50|TUI_01==51|TUI_01==52 } **occurrences of exercising** **the total occurrences of organized recreational sports** **the total occurrences of competitive sports (indoor or outdoor)** **the total occurrences of outdoor sports (non-competitive) - Skiing, skating, swimming, tennis, football, baseball** **activities - Fishing, hunting** **total occurrences of coaching or administering sports** *MAIN43: WALKING forval i= 1/82 { replace main=38 if TUI_01==57 } ***Walking, pleasure driving, and birdwatching, ** *MAIN44: CYCLING *MAIN45: OTHER OUTSIDE RECREATION *MAIN46: GARDENING / PICK MUSHROOMS *MAIN47: WALK DOGS ** Included in petcare** *MAIN48: RECEIVE OR VISIT FRIENDS *MAIN49: CONVERSATION (IN PERSON, PHONE) forval i= 1/82 { replace main=49 if TUI_01==42 } **socializing or communicating - Using any type of technology - Phone, email, social media, Skype** *MAIN50: GAMES OTHER IN-HOME, SOCIAL GAMES *MAIN51: GENERAL INDOOR LEISURE *MAIN52: ART OR MUSIC *MAIN53: CORRESPONDENSE (NOT E-LAB MAIL) forval i= 1/82 { replace main=53 if TUI_01==59 } *** the total occurrences of writing - Letters, cards, books, poems *** *MAIN54: KNIT, CRAFTS OR HOBBIES forval i= 1/82 { replace main=54 if TUI_01==56 } **arts and hobbies - Drawing, painting, crafting, playing an instrument, dancing, collecting, knitting, photography, board and card** **MAIN55: RELAX, THINK, DO NOTHING** forval i= 1/82{ replace main=55 if TUI_01==63 } ****Waiting time, free time, insomnia, thinking, smoking** *MAIN56: READ forval i= 1/82{ replace main=55 if TUI_01==58 } ***reading - Online or paper version books, periodicals, newspaper and letters** *MAIN57: LISTEN TO MUSIC ETC. forval i= 1/82{ replace main=56 if TUI_01==61 } **listening to music or radio*** *MAIN58: LISTEN TO RADIO *** included in the previous one** *MAIN59: WATCH TV, VIDEO, DVD forval i= 1/82 { replace main=59 if TUI_01==60 } ***watching television or videos** *MAIN60: COMPUTER GAMES forval i= 1/82 { replace main=60 if TUI_01==62 } **use of technology - General computer use, video games and the Internet, art or music production*** *MAIN61: E-LAB MAIL, SURF INTERNET, COMPUTING *included in the previous one* *MAIN62: NO ACT BUT RECORDED TRANSPORT MODE *MAIN63: TRAVEL TO/FROM WORK *MAIN64: EDUCATIONAL TRAVEL *MAIN65: VOLUNTARY / CIVIC / RELIGIOUS TRAVEL *MAIN66: CHILD / ADULT CARE TRAVEL *MAIN67: SHOP PERSON / HOUSEHOLD CARE TRAVEL *MAIN68: OTHER TRAVEL forval i= 1/82 { replace main=68 if TUI_01==7 } ** All travels together*** * aqui hemos incluido todo el transpore con ninos que debiamos darle una seguda pensada*** *MAIN69: NO RECORDED ACTIVITY forval i= 1/82 { replace main=69 if TUI_01==95 } *** the total occurrences of not stated or uncodable activities*** *** MAIN **** forval i=1/69{ gen main`i'=DURATION if main==`i' } replace main=69 if main==-9 ** SEC**** **THERE ARE ONLY 13 ACTIVITIES*** gen sec =. forval i= 1/82 { replace sec=18 if TUI_03A==100 } forval i= 1/82 { replace sec=6 if TUI_03A==101 } forval i= 1/82 { replace sec=20 if TUI_03A==102 } forval i= 1/82 { replace sec=28 if TUI_03A==103 } forval i= 1/82 { replace sec=23 if TUI_03A==104 } forval i= 1/82 { replace sec=27 if TUI_03A==105 } forval i= 1/82 { replace sec=49 if TUI_03A==106 } forval i= 1/82 { replace sec=61 if TUI_03A==107 } forval i= 1/82 { replace sec=56 if TUI_03A==108 } forval i= 1/82 { replace sec=59 if TUI_03A==109 } forval i= 1/82 { replace sec=58 if TUI_03A==110 } forval i= 1/82 { replace sec=60 if TUI_03A==111 } forval i= 1/82 { replace sec=54 if TUI_03A==112 } forval i= 1/82 { replace sec=69 if TUI_03A==113 } *core 25 categories* gen core25 =. replace core25 = 1 if main==2 | main==3 replace core25 = 2 if main==5 | main==6 replace core25 = 3 if main==1 | main==4 replace core25 = 4 if main==7 | main==8 | main==9 | main==10 | main==11 | /// main==12 | main==13 | main==14 replace core25 = 5 if main==15 | main==16 | main==17 replace core25 = 6 if main==18 | main==19 replace core25 = 7 if main==20 | main==21 | main==23 replace core25 = 8 if main==22 replace core25 = 9 if main==24 | main==25 | main==26 replace core25 = 10 if main==46 replace core25 = 11 if main==27 | main==47 replace core25 = 12 if main==32 replace core25 = 13 if main==28 | main==31 replace core25 = 14 if main==29 | main==30 replace core25 = 15 if main==34 replace core25 = 16 if main==33 replace core25 = 17 if main==63 | main==64 replace core25 = 18 if main==62 | main==65 | main==66 | main==67 | /// main==68 replace core25 = 19 if main==42 | main==43 | main==44 replace core25 = 20 if main==57 | main==58 | main==59 replace core25 = 21 if main==56 replace core25 = 22 if main==60 | main==61 replace core25 = 23 if main==35 | main==36 | main==37 | main==38 | /// main==39 | main==40 | main==41 | main==45 replace core25 = 24 if main==48 | main==49 | main==50 | main==51 | /// main==52 | main==53 | main==54 | main==55 replace core25 = 25 if main==69 *av41* gen av = . replace av = 1 if main==5 | main==7 | main==10 | main==12 | main==13 //location variable includes workplace and school together replace av = 2 if main==8 | main==14 replace av = 3 if main==9 replace av = 4 if main==15 | main==17 replace av = 5 if main==11 | main==63 | main==64 replace av = 6 if main==18 | main==19 replace av = 7 if main==20 | main==21 replace av = 8 if main==22 | main==23 | main==27 | main==32 replace av = 9 if main==46 replace av = 10 if main==24 | main==26 replace av = 11 if main==28 | main==29 | main==30 | main==31 replace av = 12 if main==66 | main==67 replace av = 13 if main==1 | main==4 replace av = 14 if main==25 replace av = 15 if main==6 replace av = 16 if main==2 | main==3 replace av = 17 if main==62 | main==65 | main==68 replace av = 18 if main==35 | main==38 | main==45 replace av = 19 if main==42 | main==44 replace av = 20 if main==36 replace av = 21 if main==43 | main==47 replace av = 22 if main==34 replace av = 23 if main==33 replace av = 24 if main==37 replace av = 25 if main==40 replace av = 27 if main==39 replace av = 29 if main==48 replace av = 30 if main==58 replace av = 31 if main==59 replace av = 32 if main==57 replace av = 33 if main==16 replace av = 34 if main==56 replace av = 36 if main==55 replace av = 37 if main==49 replace av = 38 if main==50 replace av = 39 if main==51 | main==52 | main==53 replace av = 40 if main==54 | main==60 | main==61 replace av = 41 if main==41 | main==69 forval i=1/41{ gen av`i'=DURATION if av==`i' } ** INOUT*** rename LOCATION PLACE gen inout=. replace inout=1 if PLACE==300|PLACE==301|PLACE==302|PLACE==303|PLACE==306|PLACE==307|PLACE==308|PLACE==309|PLACE==310|PLACE==311 replace inout=2 if PLACE==305 replace inout=3 if PLACE==313|PLACE==314|PLACE==315|PLACE==316|PLACE==317|PLACE==318|PLACE==320|PLACE==321|PLACE==319 replace inout=-8 if PLACE==996|PLACE==997|PLACE==998|PLACE==999|PLACE==304|PLACE==312 ** ELOC** gen eloc=. replace eloc =1 if PLACE==300 replace eloc =2 if PLACE==303 replace eloc =3 if PLACE==301 & TUI_01==8|TUI_01==11 replace eloc =4 if PLACE==301 & TUI_01==13 replace eloc =5 if PLACE==306| PLACE==307|PLACE==311 replace eloc =6 if PLACE==309 replace eloc =7 if PLACE==310 replace eloc =8 if PLACE==313|PLACE==314|PLACE==315|PLACE==316|PLACE==317|PLACE==318|PLACE==320|PLACE==321|PLACE==319|PLACE==319|PLACE==302 replace eloc =9 if PLACE==304|PLACE==312|PLACE==305|PLACE==302|PLACE==308 replace eloc=-8 if PLACE==996|PLACE==997|PLACE==998|PLACE==999 replace eloc=-8 if eloc==. *** ICT *** gen ict= TECHFLAG replace ict=0 if TECHFLAG==2 *MTRAV* gen mtrav=. replace mtrav=1 if PLACE==314| PLACE==313|PLACE==319 replace mtrav=2 if PLACE==316 replace mtrav=3 if PLACE==315 replace mtrav=4 if PLACE==318 replace mtrav=5 if PLACE==321|PLACE==320|PLACE==317 replace mtrav=-8 if PLACE==997|PLACE==998|PLACE==999 replace mtrav=-7 if PLACE==300|PLACE==301|PLACE==302|PLACE==303|PLACE==306|PLACE==307|PLACE==308|PLACE==309|PLACE==310|PLACE==311|PLACE==305|PLACE==312|PLACE==304 *** ALONE*** gen ALONE= TUI_06A recode ALONE (1=1)(2=0)(7/9=-8),gen(alone) ***CHILDHSD*** ** younger than15 years old** gen CHILDHSD= TUI_06C recode CHILDHSD (1=1)(2=0)(7/9=-8),gen(child) *** SPOUSE** gen SPOUSE= TUI_06B recode SPOUSE (1=1)(2=0)(7/9=-8),gen(sppart) ** OAD** gen oad=. replace oad=-7 if TUI_06E==6| TUI_06E==7| TUI_06E==8| TUI_06E==9|TUI_06F==6| TUI_06F==7| TUI_06F==8| TUI_06F==9|TUI_06G==6| TUI_06G==7| TUI_06G==8| TUI_06G==9|TUI_06H==6| TUI_06H==7| TUI_06H==8| TUI_06H==9|TUI_06I==6| TUI_06I==7| TUI_06I==8| TUI_06I==9|TUI_06J==6| TUI_06J==7| TUI_06J==8| TUI_06J==9 replace oad=1 if TUI_06E==1| TUI_06F==1| TUI_06G==1| TUI_06H==1| TUI_06I==1| TUI_06J==1 replace oad=0 if TUI_06E==2| TUI_06F==2| TUI_06G==2| TUI_06H==2| TUI_06I==2| TUI_06J==2 * WEIGHTS* *badcase* *time variables - main* gen miss = av41 //missing activities egen eatdrk = rowtotal(av6 av15 av27 av28 av29 av38) lab var eatdrk "Time spent on eating and drinking (basic act.)" egen trav = rowtotal( av5 av12 av17 av19 av21 av9 av24 av18 av29 av19) lab var trav "Time spent on traveling or exercise(basic act.)" egen rst = rowtotal(av16 av36), lab var rst "Time spent on resting/sleeping (basic act.)" egen pcare = rowtotal(av13 av14) lab var pcare "Time spent on personal care (basic act.)" gen misbasic = 0 replace misbasic = misbasic + 1 if eatdrk == 0 replace misbasic = misbasic + 1 if trav== 0 replace misbasic = misbasic + 1 if rst == 0 replace misbasic = misbasic + 1 if pcare == 0 lab var misbasic "number of missing basic activities (b.a.)" sort PUMFID EPINO merge m:1 PUMFID using "\\ad.ucl.ac.uk\homee\qtnvmve\Documents\marga\CANADA\background_ca2015.dta" *no gender or sex gen loss_sex_age=1 if sex<0 | age<0 replace loss_sex_age=0 if loss_sex_age==. * less than 7 episode count if epnum <7 *badcase* gen badcase = -5 replace badcase = 1 if miss>90 | epnum<7 | misbasic >1 | loss_sex_age!=0 replace badcase = 0 if misbasic>1 & epnum>6 & miss<91 *propwt* egen count=count(badcase) egen countp_bis=count(badcase) if badcase==0 egen countp=min(countp_bis) sort sex age day egen daywt=group(sex age day) if badcase==0 egen ngroupsd=max(daywt) if badcase==0 by sex age day: egen daycount2=count(daywt) if badcase==0 sort sex age egen weekwt=group(sex age) if badcase==0 egen ngroupsp=max(weekwt) if badcase==0 by sex age: egen wkcount2=count(weekwt) if badcase==0 generate propwt=((wkcount2/7)/daycount2) replace propwt=0 if badcase!=0 replace propwt=propwt*(count/countp) egen mean_weight=mean(propwt) replace propwt=propwt/mean_weight *nowght* gen nowght = -5 replace nowght = 1 if main69>90 replace nowght = 1 if epnum<7 replace nowght = 1 if (eatdrk==0 & rst==0 & pcare==0) tab nowght replace nowght=0 if nowght==-5 ** ocowbt** gen ocombwt= WGHT_PER keep country survey swave msamp hldid persid id day cday month year diary time clockst start end epnum main core25 sec av inout eloc ict mtrav alone child sppart oad animal parntid1 parntid2 partid hhtype hhldsize nchild agekidx agekid2 income ownhome urban computer vehicle sex age famstat singpar relrefp civstat cohab citizen wherborn empstat emp unemp student retired empsp workhrs isco1 sector edcat rushed health carer disab ocombwt propwt order country survey swave msamp hldid persid id day cday month year diary time clockst start end epnum main core25 sec av inout eloc ict mtrav alone child sppart oad animal parntid1 parntid2 partid hhtype hhldsize nchild agekidx agekid2 income ownhome urban computer vehicle sex age famstat singpar relrefp civstat cohab citizen wherborn empstat emp unemp student retired empsp workhrs isco1 sector edcat rushed health carer disab ocombwt propwt sort hldid persid id clockst save "D:\MTUS_X\MTUS_X_DAT_SUBMITT\canadian_2015_light diary\ca_main_2015.dta", replace