hi all,
I have this panel data which reports the customer-supplier linked firm with variables date, stic(ticker of supplier), ctic(ticker of customer), and siccd_sup which reports the industry category for the supplier and finally siccd which reports the industry of the customer.
For this dataset, I want to construct some basic summary statistics like:
- number of customers in the sample per year
- number of suppliers in the sample per year
- average customer-supplier relationship duration (in years)
I tried codes like
where yr was cosntructed from the date variable (gen yr=year(sdate)
and I also tried working with duplicates. But Im really just trying things without knowing exactly what I am doing.
Could someone perhaps help me in a better direction?
Thansk in advance
I have this panel data which reports the customer-supplier linked firm with variables date, stic(ticker of supplier), ctic(ticker of customer), and siccd_sup which reports the industry category for the supplier and finally siccd which reports the industry of the customer.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long sdate str8(stic ctic) double(siccd_sup siccd) 15736 "A" "HPQ" 3825 3571 15764 "A" "HPQ" 3825 3571 15795 "A" "HPQ" 3825 3571 15825 "A" "HPQ" 3825 3571 15855 "A" "HPQ" 3825 3571 15886 "A" "HPQ" 3825 3571 15917 "A" "HPQ" 3825 3571 15946 "A" "HPQ" 3825 3571 15978 "A" "HPQ" 3825 3571 16009 "A" "HPQ" 3825 3571 16037 "A" "HPQ" 3825 3571 16070 "A" "HPQ" 3825 3571 16100 "A" "HPQ" 3825 3571 16128 "A" "HPQ" 3825 3571 16161 "A" "HPQ" 3825 3571 16191 "A" "HPQ" 3825 3571 16219 "A" "HPQ" 3825 3571 16252 "A" "HPQ" 3825 3571 16282 "A" "HPQ" 3825 3571 16314 "A" "HPQ" 3825 3571 16344 "A" "HPQ" 3825 3571 16373 "A" "HPQ" 3825 3571 16405 "A" "HPQ" 3825 3571 16436 "A" "HPQ" 3825 3571 19023 "AAC" "AET" 9999 6324 19052 "AAC" "AET" 9999 6324 19082 "AAC" "AET" 9999 6324 19113 "AAC" "AET" 9999 6324 19144 "AAC" "AET" 9999 6324 19173 "AAC" "AET" 9999 6324 19205 "AAC" "AET" 9999 6324 19236 "AAC" "AET" 9999 6324 19264 "AAC" "AET" 9999 6324 19297 "AAC" "AET" 9999 6324 19996 "AAC" "AET" . 6324 20027 "AAC" "AET" 6799 6324 20055 "AAC" "AET" 6799 6324 20088 "AAC" "AET" 6799 6324 20118 "AAC" "AET" 6799 6324 20146 "AAC" "AET" 6799 6324 20178 "AAC" "AET" 6799 6324 20208 "AAC" "AET" 6799 6324 20237 "AAC" "AET" 6799 6324 20269 "AAC" "AET" 6799 6324 20300 "AAC" "AET" 6799 6324 20331 "AAC" "AET" 6799 6324 20361 "AAC" "AET" 6799 6324 20391 "AAC" "AET" 6799 6324 20422 "AAC" "AET" 6799 6324 20453 "AAC" "AET" 6799 6324 20482 "AAC" "AET" 6799 6324 20513 "AAC" "AET" 6799 6324 20544 "AAC" "AET" 6799 6324 20573 "AAC" "AET" 6799 6324 20605 "AAC" "AET" 6799 6324 20635 "AAC" "AET" 6799 6324 20664 "AAC" "AET" 6799 6324 20697 "AAC" "AET" 6799 6324 20727 "AAC" "AET" 6799 6324 20758 "AAC" "AET" 6799 6324 20788 "AAC" "AET" 6799 6324 20818 "AAC" "AET" 6799 6324 20088 "AAC" "ANTM" 6799 6324 20118 "AAC" "ANTM" 6799 6324 20146 "AAC" "ANTM" 6799 6324 20178 "AAC" "ANTM" 6799 6324 20208 "AAC" "ANTM" 6799 6324 20237 "AAC" "ANTM" 6799 6324 20269 "AAC" "ANTM" 6799 6324 20300 "AAC" "ANTM" 6799 6324 20331 "AAC" "ANTM" 6799 6324 20361 "AAC" "ANTM" 6799 6324 20391 "AAC" "ANTM" 6799 6324 20422 "AAC" "ANTM" 6799 6324 20453 "AAC" "ANTM" 6799 6324 20482 "AAC" "ANTM" 6799 6324 20513 "AAC" "ANTM" 6799 6324 20544 "AAC" "ANTM" 6799 6324 20573 "AAC" "ANTM" 6799 6324 20605 "AAC" "ANTM" 6799 6324 20635 "AAC" "ANTM" 6799 6324 20664 "AAC" "ANTM" 6799 6324 20697 "AAC" "ANTM" 6799 6324 20727 "AAC" "ANTM" 6799 6324 20758 "AAC" "ANTM" 6799 6324 20788 "AAC" "ANTM" 6799 6324 20818 "AAC" "ANTM" 6799 6324 19754 "AAMC" "RESI" 6162 6162 19782 "AAMC" "RESI" 6162 6162 19813 "AAMC" "RESI" 6162 6162 19843 "AAMC" "RESI" 6162 6162 19873 "AAMC" "RESI" 6162 6162 19904 "AAMC" "RESI" 6162 6162 19935 "AAMC" "RESI" 6162 6162 19964 "AAMC" "RESI" 6162 6162 19996 "AAMC" "RESI" 6162 6162 20027 "AAMC" "RESI" 6162 6162 20055 "AAMC" "RESI" 6162 6162 20088 "AAMC" "RESI" 6162 6162 20118 "AAMC" "RESI" 6162 6162 end format %d sdate
- number of customers in the sample per year
- number of suppliers in the sample per year
- average customer-supplier relationship duration (in years)
I tried codes like
Code:
by yr: egen xyz=group(stic ctic)
and I also tried working with duplicates. But Im really just trying things without knowing exactly what I am doing.
Could someone perhaps help me in a better direction?
Thansk in advance
Comment