Hi all,

I have a dataset with indiviudal-level data that I would like to collapse into household-level data. The dataset contains a dummy variable that is 1 when the individual has a disability, 0 otherwise.

Data example (fake data, because it's confidential):

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float(householdcode individualid disability_i)
1  1234 0
1  4566 0
1 34653 1
2 45321 0
2  3564 1
2 36433 0
end

I would like to have a dummy variable that is == 1 when any person in a household has a disability in the new household-level dataset.

I used the following code. (I am using Stata 14.)
Code:
collapse (max) disability_i by(householdcode)
In return, I got the error "factor variables not allowed". Is there a different command I could use in this case?

This is my first time posting on the forum, so I hope I explained my problem well... any suggestions on how to improve are most welcome.

Thank you!