Derivation
variable: totwalkm [average minutes spent walking] (table[s]: derived variable)
variable: totwalkd [days spent walking] (table[s]: derived variable)
variable: totmodm [average minutes spent moderate activity] (table[s]: derived variable)
variable: totmodd [days spent moderate activity] (table[s]: derived variable)
variable: totvigm [average minutes spent vigorous activity] (table[s]: derived variable)
variable: totvigd [days spent vigorous activity] (table[s]: derived variable)
variable: totmet [total metabolic units] (table[s]: derived variable)
variable: farmfix [to identify farmers not asked some of the questions] (table[s]: derived variable)
variable: phjob [if have a job] (table[s]: ncdk_personal, ncdl_personal)
A physical activity categorical variable is created as medium (1) if at least 20 minutes of vigorous exercise on at least 3 days a week, at least 30 minutes of moderate exercise on at least 5 days a week, or at least 600 metabolic units expended on at least 5 days at week, high (2) if at least 1500 metabolic units expended through vigorous activity on at least 3 days a week or at least 3000 metabolic units expended through any activity every day of the week. If physical activity is less than the medium level it is low (0). A fix is applied to people living in farming household who said they did not have a job (as they were then not asked about physical activity at work) and they are shifted up one level (unless they were already at the highest level).
gen pacat=0
replace pacat=1 if (totvigd>=3 & totvigm>=20) | (totmodd+totwalkd>=5 & totmodm+totwalkm>=30) | (totvigd+totmodd+totwalkd>=5 & totmet>=600)
replace pacat=2 if (totvigd>=3 & totmet>=1500) | (totvigd+totmodd+totwalkd>=7 & totmet>=3000)
replace pacat=pacat+1 if farmfix==1 & pacat~=2 & phjob==0
replace pacat=. if totmet==0 & pacat==0