Hello, I am working on the panel data (I am analyzing wave 1 only). The data I have look like below;
aid famid age pair sibc11 gender
10316654 2147 15 HSMF158 HS male
10316655 1569 12 HSMF138 HS male
10316656 1045 12 HSMF002 HS female
10316657 3326 16 HSFF041 HS female
10316668 1658 16 HSMM010 HS male
10316669 3036 13 FSMF381 FS male
10316610 3193 14 HSMF172 HS male
10316611 3193 14 HSMF174 HS female
aid - Identification number
famid - family identification number
age - age of a child
pair - unique pair identification number (e.g., HSMF half siblings male/female; FSMF full siblings male/female)
sibc11 - classify all sibling pair (e.g., HS - half-siblings; FS - full siblings; MZ - monozygotic; DZ - dizygotic)
My questions follow:
1. I'd like to divide siblings into younger and older siblings by gender (e.g., younger female, younger male, older female, older male).
I've looked through this webpage and based on the comments already posted here, I've tried the following commands;
gen male_age = age if gender == 0
gen female_age = age if gender == 1
rangestat (count) younger_boys = male_age younger_girls = female_age, ///
interval(age.-1) by (famid) /* using "famid" seems not adequate)
replace younger_boys = o if missing(younger_boys)
replace younger_girs = 0 if missing(younger_girls)
The outcome follows;
gen male_age = age if gender == 0
(13,488 missing values generated)
gen female_age = age if gender == 1
(13,143 missing values generated)
interval(age.-1) by (famid) /* using "famid" seems not adequate)
replace younger_boys = o if missing(younger_boys)
(7,352 real chages made)
replace younger_girs = 0 if missing(younger_girls)
(7,352 real changes made)
aid famid age pair sibc11 gender male_age female_age younger_boys younger_girls
10316654 2147 15 HSMF158 HS male 15 0 2326 2746
10316655 1569 12 HSMF138 HS male 12 0 4975 5452
10316656 1045 12 HSMF002 HS female 0 12 0 0
10316657 3326 16 HSFF041 HS female 0 16 2326 2746
10316668 1658 16 HSMM010 HS male 16 0 0 0
10316669 3036 13 FSMF381 FS male
10316610 3193 14 HSMF172 HS male
10316611 3193 14 HSMF174 HS female
***my problem is that the size of siblings is only around 3,159 out of 21,xxx so it doesn't make sense to have 7352 real changes here.
The outcome also looks very weird. How can I have 2326 for younger_boys?
Could you please help me how to fix this problem? I've tried to use some other variables--instead of using "famid"--, but it doesn't solve this problem)
What should I do?
Thanks in advance,
~Young
aid famid age pair sibc11 gender
10316654 2147 15 HSMF158 HS male
10316655 1569 12 HSMF138 HS male
10316656 1045 12 HSMF002 HS female
10316657 3326 16 HSFF041 HS female
10316668 1658 16 HSMM010 HS male
10316669 3036 13 FSMF381 FS male
10316610 3193 14 HSMF172 HS male
10316611 3193 14 HSMF174 HS female
aid - Identification number
famid - family identification number
age - age of a child
pair - unique pair identification number (e.g., HSMF half siblings male/female; FSMF full siblings male/female)
sibc11 - classify all sibling pair (e.g., HS - half-siblings; FS - full siblings; MZ - monozygotic; DZ - dizygotic)
My questions follow:
1. I'd like to divide siblings into younger and older siblings by gender (e.g., younger female, younger male, older female, older male).
I've looked through this webpage and based on the comments already posted here, I've tried the following commands;
gen male_age = age if gender == 0
gen female_age = age if gender == 1
rangestat (count) younger_boys = male_age younger_girls = female_age, ///
interval(age.-1) by (famid) /* using "famid" seems not adequate)
replace younger_boys = o if missing(younger_boys)
replace younger_girs = 0 if missing(younger_girls)
The outcome follows;
gen male_age = age if gender == 0
(13,488 missing values generated)
gen female_age = age if gender == 1
(13,143 missing values generated)
interval(age.-1) by (famid) /* using "famid" seems not adequate)
replace younger_boys = o if missing(younger_boys)
(7,352 real chages made)
replace younger_girs = 0 if missing(younger_girls)
(7,352 real changes made)
aid famid age pair sibc11 gender male_age female_age younger_boys younger_girls
10316654 2147 15 HSMF158 HS male 15 0 2326 2746
10316655 1569 12 HSMF138 HS male 12 0 4975 5452
10316656 1045 12 HSMF002 HS female 0 12 0 0
10316657 3326 16 HSFF041 HS female 0 16 2326 2746
10316668 1658 16 HSMM010 HS male 16 0 0 0
10316669 3036 13 FSMF381 FS male
10316610 3193 14 HSMF172 HS male
10316611 3193 14 HSMF174 HS female
***my problem is that the size of siblings is only around 3,159 out of 21,xxx so it doesn't make sense to have 7352 real changes here.
The outcome also looks very weird. How can I have 2326 for younger_boys?
Could you please help me how to fix this problem? I've tried to use some other variables--instead of using "famid"--, but it doesn't solve this problem)
What should I do?
Thanks in advance,
~Young
Comment