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 open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.