/******************************************************************
Scale ID: 			CAGE
Scale Name: 		C (Cut Down) A (Annoyed) G (Guilty) E (Eye-opener)
TILDA Variables: 	BEHcage; BEHcage2
Dataset:      		TILDA Waves 1-7
Author:       
Institution:  		The Irish Longitudinal Study on Ageing (TILDA)

Description:
Creates disability variables from functional impairments, activities of daily living, and instrumental activities of daily living.

Version:      1.0
Date:         2026-09-01
Language:     Stata

******************************************************************/

*recodes No from 2 to 0 & not answered from -99 to . for CAGE variables for them to be added up

lab define cage 0 "No" 1 "Yes"
foreach var of varlist SCQCAGE1 SCQCAGE2 SCQCAGE3 SCQCAGE4 {
	gen `var'_r = `var'
	recode `var'_r (-99 = .)(4 = .)(2 = 0)
	lab values `var'_r cage
}

egen miss_cage =  rowmiss(SCQCAGE1_r - SCQCAGE4_r)
tab miss_cage, mis

egen na_cage = anycount(SCQCAGE1_r - SCQCAGE4_r), v(-1) // no of values versus number of missing values
tab na_cage 

tab SCQCAGE1_r, mis
tab SCQCAGE2_r, mis
tab SCQCAGE3_r, mis
tab SCQCAGE4_r, mis

gen BEHcage = SCQCAGE1_r + SCQCAGE2_r + SCQCAGE3_r + SCQCAGE4_r   //adds everything except -1 values
label variable BEHcage "CAGE alcohol scale"
tab BEHcage, mis 

drop SCQCAGE1_r SCQCAGE2_r SCQCAGE3_r SCQCAGE4_r 

*Always have -1 for all 4 items - coded to -1 for the scale // missing by design
recode BEHcage -4 = -1
recode BEHcage -3 = -1
tab BEHcage, mis

*Set -1 to 0 if they say no to ever drinking or no to drinking in last 6 months
*This is everyone routed around, so no -1s left in the variable
recode BEHcage (-1=0) if SCQAlcoHis1==2 | SCQAlcoHis2==2
tab BEHcage, mis

notes BEHcage : CAGE total - excludes those with any missing on the CAGE

*********************************************************************************
*Alcohol problem

gen BEHcage2 = 0 if BEHcage !=.
replace BEHcage2 = 1 if BEHcage==2 | BEHcage==3 | BEHcage==4
label variable BEHcage2 "Alcohol problem"
lab define alcohol 0 "No" 1 "Yes"
lab values BEHcage2 alcohol
tab BEHcage2, m

notes BEHcage2: Score of 2 or more on the CAGE questionnaire

replace BEHcage = . if in_scq == 0 // Did not do SCQ
replace BEHcage2 = . if in_scq == 0 // Did not do SCQ