Dear All, I find this question here. The data is
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input byte id int year str1 industry float x str6 name float(fq_x w)
 1 2008 "A"   1 "张三" 1 0
 2 2008 "A" 1.2 "张三" 1 0
 8 2008 "A" 1.4 "孙七" 1 0
 3 2008 "A" 1.5 "王八" 2 0
 4 2008 "A" 1.8 "李四" 2 0
 7 2008 "A" 1.6 "李四" 2 0
 5 2008 "A"   2 "赵五" 3 2
 6 2008 "A" 2.2 "张三" 3 2
 9 2008 "A" 2.5 "赵五" 3 2
10 2008 "A" 2.6 "陈九" 4 0
11 2008 "A" 2.8 "李四" 4 0
15 2008 "A" 2.6 "赵五" 4 0
12 2008 "A" 3.7 "王八" 5 0
13 2008 "A" 3.5 "陈九" 5 0
14 2008 "A" 3.3 "李四" 5 0
16 2008 "B"   1 "张三" 1 0
17 2008 "B" 1.2 "李四" 1 0
23 2008 "B" 1.4 "赵五" 1 0
18 2008 "B" 1.5 "孙七" 2 1
19 2008 "B" 1.8 "赵五" 2 1
22 2008 "B" 1.6 "孙七" 2 1
20 2008 "B"   2 "陈九" 3 1
21 2008 "B" 2.2 "李四" 3 1
24 2008 "B" 2.5 "陈九" 3 1
25 2008 "B" 2.6 "李四" 4 1
26 2008 "B" 2.8 "王八" 4 1
30 2008 "B" 2.6 "孙七" 4 1
27 2008 "B" 3.7 "陈九" 5 2
28 2008 "B" 3.5 "李四" 5 2
29 2008 "B" 3.3 "赵五" 5 2
31 2009 "A"   1 "张三" 1 0
32 2009 "A" 1.2 "李四" 1 0
38 2009 "A" 1.4 "赵五" 1 0
33 2009 "A" 1.5 "孙七" 2 1
34 2009 "A" 1.8 "赵五" 2 1
37 2009 "A" 1.6 "孙七" 2 1
35 2009 "A"   2 "陈九" 3 1
36 2009 "A" 2.2 "李四" 3 1
39 2009 "A" 2.5 "陈九" 3 1
40 2009 "A" 2.6 "李四" 4 1
41 2009 "A" 2.8 "王八" 4 1
45 2009 "A" 2.6 "孙七" 4 1
42 2009 "A" 3.7 "陈九" 5 2
43 2009 "A" 3.5 "李四" 5 2
44 2009 "A" 3.3 "赵五" 5 2
46 2009 "B" 1.2 "赵五" 1 0
47 2009 "B" 1.5 "张三" 1 0
52 2009 "B" 1.4 "李四" 1 0
48 2009 "B" 1.8 "李四" 2 1
49 2009 "B"   2 "孙七" 2 1
51 2009 "B" 1.6 "陈九" 2 1
50 2009 "B" 2.2 "赵五" 3 2
53 2009 "B" 2.5 "孙七" 3 2
54 2009 "B" 2.6 "赵五" 3 2
55 2009 "B" 2.8 "陈九" 4 1
59 2009 "B" 2.7 "李四" 4 1
60 2009 "B" 3.2 "陈九" 4 1
56 2009 "B" 3.7 "李四" 5 1
57 2009 "B" 3.5 "王八" 5 1
58 2009 "B" 3.3 "陈九" 5 1
end
  1. For each year and industry, how can we count the number of same names (`name') in other `fq_x' group. For instance, for fq_x=1, we want find the number of same names (张三,张三,孙七) in other fq_x=2,3,4,5 groups. Similar procedures apply to fq_x=2. In this case, we want find the number of same names (王八,李四,李四) in other fq_x=1,3,4,5 groups.
  2. If you have problem in recognizing Chinese, I can modify the data (name) into English. Thanks.
  3. `w' is the desired results.