Hi,
I have a typical sex variable where 1 is male and 2 is female. I am trying to build a value 3 which would be everyone, so that I might have a loop that goes from male to female, to everyone.
I am really struggling for some reason to build number 3. I thought this would be simple but it is not proving to be. Does anyone have any suggestions?
This is what I have now but its not working.
I have a typical sex variable where 1 is male and 2 is female. I am trying to build a value 3 which would be everyone, so that I might have a loop that goes from male to female, to everyone.
I am really struggling for some reason to build number 3. I thought this would be simple but it is not proving to be. Does anyone have any suggestions?
This is what I have now but its not working.
Code:
gen allsex = . egen allsex1 = max(sex == 1 | sex == 2) replace allsex = 3 if allsex1 == 1 replace allsex = 1 if sex == 1 replace allsex = 2 if sex == 2
Comment