Dear member of this forum,
I’m using Stata 13.1 / SE on Windows 10 for analyzing some behavior of unemployed persons.
In my used dataset, I observe the persons choice of different job search channels. My observed persons are identified by a Person-ID and the choice of each used channel is identified by a dummy. Moreover, I have already created a variable indicating how many search channel the persons choose in total.
Thus, my dataset looks like the following:
My goal is to report the quantity of the different combinations used by the observed persons per number of used channels in total, i.e. I want to report how often my observed people choose a combination of search channels if they decide for one, two, three .... ten used channels in total.
For one channel used in total there are obviously 10C1 = 10 possible "combinations".
For two channels used in total: 10C2 = 45 , for instance {channel1 & channel2} , {channel1 & channel3}, {channel1 & channel4} ... {channel9 & channel10}
For three channels used in total: 10C3 = 120
For four channels used in total: 10C4 = 210
For five channels used in total: 10C5 = 252
For six channels used in total: 10C6 = 210
....
....
....
For ten channels used in total 10C10 = 1
I tried to solve this issue with looping and the command count, because I could not find any hint for a suitable command or algorithm here and on other boards. However when I realized the huge amount of different combinations, I hoped that maybe one of you clever guys has a better solution?
For the combination of two used channels in total, I used the following:
This is the result for one and two channels combined in one table:

For the combinations of three channels in total, I took the loop from above, added one channel condition per count command, copied it eight times and manipulated it by hand.
e.g. for one command:
This is the result:

Since its becoming really difficult and time consuming to specify all the conditions "per hand", I wanted to give a try in this forum.
Thanks in advance!
Bests
Andreas
I’m using Stata 13.1 / SE on Windows 10 for analyzing some behavior of unemployed persons.
In my used dataset, I observe the persons choice of different job search channels. My observed persons are identified by a Person-ID and the choice of each used channel is identified by a dummy. Moreover, I have already created a variable indicating how many search channel the persons choose in total.
Thus, my dataset looks like the following:
Person-ID | channel 1 | channel 2 | channel 3 | channel 4 | channel 5 | channel 6 | channel 7 | channel 8 | channel 9 | channel 10 | Number of used channels |
1001 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
5412 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 |
4816 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 3 |
1271 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 5 |
1100 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 10 |
My goal is to report the quantity of the different combinations used by the observed persons per number of used channels in total, i.e. I want to report how often my observed people choose a combination of search channels if they decide for one, two, three .... ten used channels in total.
For one channel used in total there are obviously 10C1 = 10 possible "combinations".
For two channels used in total: 10C2 = 45 , for instance {channel1 & channel2} , {channel1 & channel3}, {channel1 & channel4} ... {channel9 & channel10}
For three channels used in total: 10C3 = 120
For four channels used in total: 10C4 = 210
For five channels used in total: 10C5 = 252
For six channels used in total: 10C6 = 210
....
....
....
For ten channels used in total 10C10 = 1
I tried to solve this issue with looping and the command count, because I could not find any hint for a suitable command or algorithm here and on other boards. However when I realized the huge amount of different combinations, I hoped that maybe one of you clever guys has a better solution?
For the combination of two used channels in total, I used the following:
Code:
foreach i in channel1 channel2 channel3 channel4 channel5 channel6 channel7 channel8 channel9 channel10 { count if `i' == 1 & channel1 == 1 & number_channels_unempl == 2 count if `i' == 1 & channel2== 1 & number_channels_unempl == 2 count if `i' == 1 & channel3 == 1 & number_channels_unempl == 2 count if `i' == 1 & channel4 == 1 & number_channels_unempl == 2 count if `i' == 1 & channel5 == 1 & number_channels_unempl == 2 count if `i' == 1 & channel6 == 1 & number_channels_unempl == 2 count if `i' == 1 & channel7== 1 & number_channels_unempl == 2 count if `i' == 1 & channel8 == 1 & number_channels_unempl == 2 count if `i' == 1 & channel9 == 1 & number_channels_unempl == 2 count if `i' == 1 & channel10 == 1 & number_channels_unempl == 2 }
For the combinations of three channels in total, I took the loop from above, added one channel condition per count command, copied it eight times and manipulated it by hand.
e.g. for one command:
Code:
count if `i' == 1 & channel1 == 1 & channel3 == 1 & number_channels_unempl == 3
Since its becoming really difficult and time consuming to specify all the conditions "per hand", I wanted to give a try in this forum.
Thanks in advance!
Bests
Andreas
Comment