Hi Statalist,
In my airline dataset, I have 2 variables: carrier & origin airport. I want to generate a variable (say X) that takes 1 if there is only one carrier in each airport. Moreover, it takes 1 if there is more than one carrier in each airport but more than 90% of that airport's observations are from only one carrier (x takes 1 in front of that carrier's observation).
I would appreciate any insights.
The following table is just an example. I want to know how to code this.
Thanks,
In my airline dataset, I have 2 variables: carrier & origin airport. I want to generate a variable (say X) that takes 1 if there is only one carrier in each airport. Moreover, it takes 1 if there is more than one carrier in each airport but more than 90% of that airport's observations are from only one carrier (x takes 1 in front of that carrier's observation).
I would appreciate any insights.
The following table is just an example. I want to know how to code this.
Thanks,
carrier | origin |
2 | 2 |
4 | 2 |
2 | 2 |
4 | 2 |
4 | 2 |
4 | 2 |
3 | 2 |
2 | 2 |
2 | 2 |
3 | 2 |
2 | 2 |
3 | 2 |
1 | 2 |
4 | 2 |
3 | 3 |
2 | 5 |
2 | 5 |
2 | 5 |
2 | 6 |
2 | 6 |
2 | 6 |
2 | 6 |
2 | 6 |
2 | 6 |
2 | 6 |
2 | 6 |
2 | 6 |
2 | 6 |
2 | 6 |
3 | 7 |
4 | 7 |
3 | 7 |
3 | 7 |
3 | 7 |
3 | 7 |
3 | 7 |
3 | 7 |
3 | 7 |
3 | 7 |
3 | 7 |
2 | 9 |
2 | 9 |
2 | 9 |
2 | 9 |
2 | 9 |
2 | 9 |
2 | 9 |
2 | 9 |
2 | 9 |
2 | 9 |
2 | 9 |
2 | 9 |
2 | 9 |
2 | 9 |
2 | 9 |
Comment