
/*-------------------------------------------------------------------------------------------------------------------* 
|  This file is for those who use the info of reasons for work hour loss during Covid-19                             |
|  Users should be aware of how the information is collected.                                                        |
|                                                                                                                    | 
|  In the UKHLS covid survey, there are four situations in which individuals are counted as “working hours loss”     |
|      and are asked for reasons. The criteria are                                                                   |
|      - 1. Those who did not answer previous waves. They are employed/self-employed in Jan/Feb and                  |
|            their work hours now are fewer than Jan/Feb. Note that their working hours in Jan/Feb and               |
|			 now are not missing.                                                                                    |
|      - 2.	Those who did not answer previous waves. They are employed/self-employed in Jan/Feb and not working now. |
|      - 3.	Those who answered previous waves. They are employed/self-employed now. Their work hours are fewer       | 
|            than previous waves. Of course, work hours in both waves are not missing.                               |
|      - 4.	Those who answered previous waves. They are employed in previous wave and not working now.               |
|                                                                                                                    |
|  The reason why we have to be causious when using this variable is that                                            |
|      for individuals who        do previous waves, their info compares with previous wave, and                     |
|	   for individuals who do not do previous waves, their info compare  with Jan/Feb.                               |
|	                                                                                                                 |
|  That means you cannot take one single wave to know if a person experienced work hours loss and for what reasons   |
|  during the pandemic. For example, people who experience work hour loss in wave 1 but do not have a further        |
|  decline in work hours in wave 2&3, are not captured when only using wave 3.                                       |
|--------------------------------------------------------------------------------------------------------------------*/
                                                                   
* This file just takes Covid w1-w3 as an exmaple for users 

  
*== Work Hour Loss ==*
*-1. Merge Covid w1, w2, and w3 data (make sure every data is sorted by pidp)

* use "~\ca_indresp_w.dta", clear
* sort pidp 
* merge pidp using "~\cb_indresp_w.dta"
* sort pidp 
* merge pidp using "~\cc_indresp_w.dta"

*-2. Generate accumulative info for experiencing work hour loss

* Experience work hours loss between Jan/Feb - Apr
gen     workhrloss1=0
replace workhrloss1=1   if (ca_ff_prevsurv==0 & (ca_blwork>=1&ca_blwork<=3) & (ca_hours<ca_blhours&ca_hours>=0&ca_blhours>=0))| ///
		                   (ca_ff_prevsurv==0 & (ca_blwork>=1&ca_blwork<=3) & ca_sempderived==4)
						   
replace workhrloss1=.   if !inlist(ca_outcome,11) 

label var  workhrloss1 "Experience work hours loss between Jan/Feb - Apr" 
label define workhrloss 0"No" 1"Yes", modify
label val workhrloss1 workhrloss
				  
				  
* Expereince work houes loss between Jan/Feb - May

gen     workhrloss12=0
replace workhrloss12=1 if (cb_ff_prevsurv==0 & (cb_blwork>=1&cb_blwork<=3) & (cb_hours < cb_blhours&cb_hours>=0&cb_blhours>=0))| ///
                          (cb_ff_prevsurv==0 & (cb_blwork>=1&cb_blwork<=3) & cb_sempderived==4)| ///
                          (cb_ff_prevsurv==1 & (cb_sempderived>=1&cb_sempderived<=3) & (cb_hours < cb_ff_hours&cb_hours>=0&cb_ff_hours>0))| ///
			              (cb_ff_prevsurv==1 & (cb_ff_semp>=1&cb_ff_semp<=3) & cb_sempderived==4)
replace workhrloss12=1 if workhrloss12==0 & workhrloss1==1

replace workhrloss12=. if !inlist(cb_outcome,11) 


label var  workhrloss12 "Expereince work houes loss between Jan/Feb - May" 
label val workhrloss12 workhrloss


	
* Expereince work houes loss between Jan/Feb - June
gen     workhrloss13=0
replace workhrloss13=1 if (cc_ff_prevsurv==0 & (cc_blwork>=1&cc_blwork<=3) & (cc_hours < cc_blhours&cc_hours>=0&cc_blhours>=0))| ///
                          (cc_ff_prevsurv==0 & (cc_blwork>=1&cc_blwork<=3) & cc_sempderived==4)| ///
                          (cc_ff_prevsurv==1 & (cc_sempderived>=1&cc_sempderived<=3) & (cc_hours < cc_ff_hours&cc_hours>=0&cc_ff_hours>=0))| ///
			              (cc_ff_prevsurv==1 & (cc_ff_semp>=1&cc_ff_semp<=3) & cc_sempderived==4)
					  
replace workhrloss13=1 if workhrloss13==0&(workhrloss1==1|workhrloss12==1)

replace workhrloss12=. if !inlist(cc_outcome,11) 

label var  workhrloss13 "Expereince work houes loss between Jan/Feb - June"    
label val workhrloss13 workhrloss 
 
*-3. Reasons for experiencing work hour loss
    * Note 1: people can choose more than one reasons
	* Note 2: codings below is just an example for users who would like to use the variables
	* Note 3: some new categories shown since wave 2, such as variation or quit
	* Note 4: UKHLS collect data separately for those employed, those self-employed, and those both employed and self-employed

* Experiencing work hour loss during w1-w3, due to 

//a. furlough 
gen furlough13=.
foreach w in cc cb ca{
  replace furlough13=1 if (`w'_hrschange15==1|`w'_hrschange35==1) 
}

label var furlough13 "ever furloghed between April-June"


//b. being laid off
gen laidoff13=.
foreach w in cc cb ca{
replace laidoff13=3 if laidoff13==.&(`w'_hrschange11==1|`w'_hrschange12==1|`w'_hrschange13==1)|(`w'_hrschange31==1|`w'_hrschange32==1|`w'_hrschange33==1)
}

label var laidoff13 "ever laid off between April-June"


//c. (Users can do more depending on their research interests)



* Shih-Yi Chao 
* S-Y.Chao@soton.ac.uk

