Dear people,
Could you please help me on the following issue ?
I have a continuous variable describing the mental health score, I created tertile from this continuous variable, and tabstat to have the mean in each tertile. Now I would like to create a new variable of these tertile mean. Is that possible ? I tried to do all combination, without success.
Here is my data look like :
What I want is to extract the means from tabstat and create a new variable with it, such as the following example table. Because afterwards I need to do a linear regression.
tertile mean
1 xx
2 xx
3 xx
Many thanks for your help
Ginie
Could you please help me on the following issue ?
I have a continuous variable describing the mental health score, I created tertile from this continuous variable, and tabstat to have the mean in each tertile. Now I would like to create a new variable of these tertile mean. Is that possible ? I tried to do all combination, without success.
Here is my data look like :
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float fatherK2 0 2 1 25 0 1 0 2 4 3 1 3 3 0 2 0 6 1 2 3 0 end label values fatherK2 ght label def ght 25 "No father at home", modify
Code:
xtile fatherK2_T3=fatherK2, nq(3)
Code:
tabstat fatherK2, stat (mean sd n) by (fatherK2_T3)
tertile mean
1 xx
2 xx
3 xx
Many thanks for your help
Ginie
Comment