Hi experts
I want to count the experiences of employees (i.e., personalID), with respect to years such as if they worked in 2001 with company 4 as well as with company 8 so the wanted should be 1 no 2. Sample data is as follows
Thanks and Regards

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float(id year personalID wanted)
4 2001 1001 1
8 2001 1001 1
4 2003 1001 2
8 2003 1001 2
8 2004 1001 3
4 2004 1001 3
4 2001 1002 1
8 2002 1002 2
4 2002 1002 2
8 2003 1002 3
4 2004 1002 4
8 2001 1003 1
4 2002 1003 2
4 2003 1003 3
8 2004 1003 4
8 2002 1004 1
end