Dear Madam/Sir,
I would like to pick control firms (gvkey2 in dataset2 with respect to gvkey1 and year) using treatment firms (gvkey and merge_year in the same industry_code in dataset 1).
Have
dataset 1 dataset 2
gvkey merge_year industry_code gvkey1 year gvkey2
Want
new dataset (matching identifier: gvkey(dataset1)=gvkey1(dataset2), merge_year(dataset2)=year(dataset2))
gvkey merge_year industry_code gvkey2
Any programming idea will be highly appreciated. Two datasets are attached.
Sincerely,
Joon
@joon1 wrote:
I would like to pick control firms (gvkey2 in dataset2 with respect to gvkey1 and year) using treatment firms (gvkey and merge_year in the same industry_code in dataset 1).
Have
dataset 1 dataset 2
gvkey merge_year industry_code gvkey1 year gvkey2
Want
new dataset (matching identifier: gvkey(dataset1)=gvkey1(dataset2), merge_year(dataset2)=year(dataset2))
gvkey merge_year industry_code gvkey2
Any programming idea will be highly appreciated. Two datasets are attached.
I don't understand your task well enough to consider this a program question yet. My questions are:
Thank you for insightful comments, mkeintz.
You are correct. To simplify programming, I have dropped observations that have different industry (SIC code) between gvkey1 and gvkey 2 in dataset 2 to have only observations with the same industry between gvkey1 and gvkey2. The industry issue is resolved. I attach a part of revised dataset2 (it is over 8 million observations). For your a second serious questions, my goal is to have unique control firms (gvkey2) in a particular year that match between gvkey/merge_year in dataset1 and gvkey1/year in dataset 2. It could be multiple control firms (gvkey2) matched with gvkey in dataset 1 in a particular year.
Any programming advice will be highly appreciated.
Thanks
Joon1
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.