Hello you all,
I am currently working on an assignment were I want to match a group of companies doing an IPO to a control group by industry and market cap.
For the industry I need to match on SIC codes, the problem now is that not every treated company has a control company with the same 3-digit SIC code.
I am trying to make an algorithm (a loop) which will first look at the 3-digit SIC code, but when there is no match, it should look at the 2-digit SIC code. And when
there is no match on the 2-digit SIC code, looks on the 1-digit SIC code. But i haven't found the right algorithm at this moment.
I know that I need to merge the two groups of companies and use:
merge 1:M 3SICCODE using control group
keep if _merge ==3
But before or after this there needs to be a line where it will search for another match of a 2-digit SIC code or even a 1-digit SIC code. Because it could also be possible that
the _merge is 1(treated group) or 2(control group), so there is no match.
Maybe someone of you can help me?
Many thanks
I am currently working on an assignment were I want to match a group of companies doing an IPO to a control group by industry and market cap.
For the industry I need to match on SIC codes, the problem now is that not every treated company has a control company with the same 3-digit SIC code.
I am trying to make an algorithm (a loop) which will first look at the 3-digit SIC code, but when there is no match, it should look at the 2-digit SIC code. And when
there is no match on the 2-digit SIC code, looks on the 1-digit SIC code. But i haven't found the right algorithm at this moment.
I know that I need to merge the two groups of companies and use:
merge 1:M 3SICCODE using control group
keep if _merge ==3
But before or after this there needs to be a line where it will search for another match of a 2-digit SIC code or even a 1-digit SIC code. Because it could also be possible that
the _merge is 1(treated group) or 2(control group), so there is no match.
Maybe someone of you can help me?
Many thanks
Comment