I am working with child data and having difficulties trying to create a variable that contains birth order and whether the child has older brothers or sisters with respect to the child id = 0.
Something similar with this code here,
0=child is firstborn
1=child is secondborn and has an older brother
2=child is secondborn and has an older sister
3=child is thirdborn or higher birth order and has at least one older brother
4=child is thirdborn or higher birth order and has no older brothers.
I have this sample as an example data
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str8 childid byte(id age sex relate) "010001" 0 4 1 0 "010001" 1 31 1 1 "010001" 2 23 2 1 "010001" 3 1 2 7 "010002" 0 5 1 0 "010002" 1 45 1 1 "010002" 2 36 2 1 "010003" 0 4 1 0 "010003" 2 34 1 1 "010003" 3 26 2 1 "010003" 4 3 2 7 "010004" 0 5 2 0 "010004" 1 39 1 1 "010004" 2 31 2 1 "010004" 3 10 2 7 "010004" 4 9 2 7 "010005" 0 5 2 0 "010005" 3 42 1 1 "010005" 4 31 2 1 "010006" 0 5 1 0 end label values sex memsex label def memsex 1 "male", modify label def memsex 2 "female", modify label values relate relate label def relate 0 "yl child", modify label def relate 1 "biological parent", modify label def relate 7 "brother/sister (both parents the same)", modify
Thank you in advance
0 Response to Data construction and management
Post a Comment