Dear stata,
I need some help. I am using egen to combine two categorical variables to obtain one variable with the combinations. I followed the instructions, but for some odd reason, stata is not assigning a different number for each new category.
Any reason why these are odd results? I am using STATA 16.1 and I have already updated it.
Many thanks
Juan
. tab1 depfreq deplevel
-> tabulation of depfreq
How often depressed Freq. Percent Cum.
1. Daily 1,350 4.22 4.22
2. Weekly 1,963 6.14 10.36
3. Monthly 2,515 7.86 18.22
4. A few times a year 9,235 28.87 47.09
5. Never 16,927 52.91 100.00
Total 31,990 100.00
-> tabulation of deplevel
Level of how depressed Freq. Percent Cum.
1. A little 7,536 48.99 48.99
2. A lot 2,163 14.06 63.05
3. Somewhere in between a little and a 5,684 36.95 100.00
Total 15,383 100.00
egen depression1 = group( depfreq deplevel), label
(17,296 missing values generated)
. tab1 depression1
-> tabulation of depression1
group(depfreq deplevel) Freq. Percent Cum.
1. Daily 1. A little 232 1.51 1.51
1. Daily 2. A lot 588 3.83 5.35
1. Daily 3. Somewhere in between a litt 525 3.42 8.77
2. Weekly 1. A little 531 3.46 12.24
2. Weekly 2. A lot 437 2.85 15.09
2. Weekly 3. Somewhere in between a lit 992 6.47 21.55
3. Monthly 1. A little 1,003 6.54 28.10
3. Monthly 2. A lot 335 2.18 30.28
3. Monthly 3. Somewhere in between a li 1,174 7.66 37.94
4. A few times a year 1. A little 5,594 36.48 74.42
4. A few times a year 2. A lot 723 4.72 79.14
4. A few times a year 3. Somewhere in b 2,886 18.82 97.96
5. Never 1. A little 152 0.99 98.95
5. Never 2. A lot 72 0.47 99.42
5. Never 3. Somewhere in between a litt 89 0.58 100.00
Total 15,333 100.00
.
I need some help. I am using egen to combine two categorical variables to obtain one variable with the combinations. I followed the instructions, but for some odd reason, stata is not assigning a different number for each new category.
Any reason why these are odd results? I am using STATA 16.1 and I have already updated it.
Many thanks
Juan
. tab1 depfreq deplevel
-> tabulation of depfreq
How often depressed Freq. Percent Cum.
1. Daily 1,350 4.22 4.22
2. Weekly 1,963 6.14 10.36
3. Monthly 2,515 7.86 18.22
4. A few times a year 9,235 28.87 47.09
5. Never 16,927 52.91 100.00
Total 31,990 100.00
-> tabulation of deplevel
Level of how depressed Freq. Percent Cum.
1. A little 7,536 48.99 48.99
2. A lot 2,163 14.06 63.05
3. Somewhere in between a little and a 5,684 36.95 100.00
Total 15,383 100.00
egen depression1 = group( depfreq deplevel), label
(17,296 missing values generated)
. tab1 depression1
-> tabulation of depression1
group(depfreq deplevel) Freq. Percent Cum.
1. Daily 1. A little 232 1.51 1.51
1. Daily 2. A lot 588 3.83 5.35
1. Daily 3. Somewhere in between a litt 525 3.42 8.77
2. Weekly 1. A little 531 3.46 12.24
2. Weekly 2. A lot 437 2.85 15.09
2. Weekly 3. Somewhere in between a lit 992 6.47 21.55
3. Monthly 1. A little 1,003 6.54 28.10
3. Monthly 2. A lot 335 2.18 30.28
3. Monthly 3. Somewhere in between a li 1,174 7.66 37.94
4. A few times a year 1. A little 5,594 36.48 74.42
4. A few times a year 2. A lot 723 4.72 79.14
4. A few times a year 3. Somewhere in b 2,886 18.82 97.96
5. Never 1. A little 152 0.99 98.95
5. Never 2. A lot 72 0.47 99.42
5. Never 3. Somewhere in between a litt 89 0.58 100.00
Total 15,333 100.00
.
Comment