Dear colleagues,
I am working with a dataset with more than one entity per cluster. Meaning that the dataset contains one case for the main person and one for his/her partner.
The partner case can be linked to the main person case through an id-variable. However, both entities have different variables which is not a problem at first sight.
Nevertheless, I have some problems generating a proper if function to apply my calculations.
Imagine the following scenario.
The main person and his/her partner are living together.
The main person has a child.
The partner of this main person has a child.
This will result in the outcome variable: both have a child.
This is relatively easy to program in stata but for my applications only one of both entities needs to have children to result that the outcome variable switch to: both have a child.
This is important if the main person doesn't have a child but his/her partner, vice versa. Without the needed "function", I would neglect those cases.
My first attempts tried to use the sort command and some if commands but failed.
Does anyone know how to generate such an outcome variable?
Thanks a lot in advance for your help.
PS.: Data is held in long format
I am working with a dataset with more than one entity per cluster. Meaning that the dataset contains one case for the main person and one for his/her partner.
The partner case can be linked to the main person case through an id-variable. However, both entities have different variables which is not a problem at first sight.
Nevertheless, I have some problems generating a proper if function to apply my calculations.
Imagine the following scenario.
The main person and his/her partner are living together.
The main person has a child.
The partner of this main person has a child.
This will result in the outcome variable: both have a child.
This is relatively easy to program in stata but for my applications only one of both entities needs to have children to result that the outcome variable switch to: both have a child.
This is important if the main person doesn't have a child but his/her partner, vice versa. Without the needed "function", I would neglect those cases.
My first attempts tried to use the sort command and some if commands but failed.
Does anyone know how to generate such an outcome variable?
Thanks a lot in advance for your help.
PS.: Data is held in long format