I am using Stata for my project that links supplier-customer transaction records.
Let's go to my data. I have suppliers and customers with their names and IDs (CUSIP). I want to identify their transaction records by years and accordingly create numbers of their linkage years.
For example, see the below data. ABS Industry is the supplier and it has several customers in different years (possibly more than one customer within one year.). I want to identify how many years the supplier has transaction record with their customers.
Say, in 1982, ABS Industry's linkage year with EMERSON ELECTRIC CO is 1.
In 1985, ABS Industry's linkage year with EROY PROPERTIES & DEV CORP is 1.
In the same year, ABS Industry's linkage year with CHRYSLER CORP is 1.
In 1986, ABS Industry's linkage year with CHRYSLER CORP is 2 because it has already had transaction with the same customer in last year.
In 1987, ABS Industry's linkage year with CHRYSLER CORP is 3.
The logic should be like this. Hope guys brilliant with this could help me. Thanks in advance.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input double fyear str58 SuuplierName str8 CUSIP str58 CustomerName str8 CustomerCUSIP float CSales 1982 "ABS INDUSTRIES INC" "00078110" "EMERSON ELECTRIC CO" "29101110" 4.321 1985 "ABS INDUSTRIES INC" "00078110" "LEROY PROPERTIES & DEV CORP" "52681010" 2.0509999 1985 "ABS INDUSTRIES INC" "00078110" "CHRYSLER CORP" "17119610" 3.896 1986 "ABS INDUSTRIES INC" "00078110" "CHRYSLER CORP" "17119610" 3.468 1987 "ABS INDUSTRIES INC" "00078110" "CHRYSLER CORP" "17119610" 3.128 1988 "ABS INDUSTRIES INC" "00078110" "FORD MOTOR CO" "34537086" 11.936 1988 "ABS INDUSTRIES INC" "00078110" "CHRYSLER CORP" "17119610" 3.979 1989 "ABS INDUSTRIES INC" "00078110" "FORD MOTOR CO" "34537086" 16.374 1989 "ABS INDUSTRIES INC" "00078110" "CHRYSLER CORP" "17119610" 6.186 1990 "ABS INDUSTRIES INC" "00078110" "CHRYSLER CORP" "17119610" 5.268 1990 "ABS INDUSTRIES INC" "00078110" "FORD MOTOR CO" "34537086" 15.398 1991 "ABS INDUSTRIES INC" "00078110" "FORD MOTOR CO" "34537086" 13.402 1991 "ABS INDUSTRIES INC" "00078110" "CHRYSLER CORP" "17119610" 3.984 1992 "ABS INDUSTRIES INC" "00078110" "FORD MOTOR CO" "34537086" 12.338 1993 "ABS INDUSTRIES INC" "00078110" "FORD MOTOR CO" "34537086" 14.472 1994 "ABS INDUSTRIES INC" "00078110" "FORD MOTOR CO" "34537086" 17.503 end
0 Response to Link suppliers-customer's transaction records by years
Post a Comment