Dear all
greetings of the day
it is the continuation of the further programming for the previous data in which i requested a SAS programming code to identify the peer group companies
my dataset is in the following format
Name | year | mcap | synch | code | RANK | ESG |
Oil & Natural Gas Corpn. Ltd. | 2010 | 2,349,765 | 1.60 | 610 | 1 | 1 |
Oil India Ltd. | 2010 | 277,160 | 0.55 | 610 | 2 | 0 |
Selan Exploration Technology Ltd. | 2010 | 6,604 | 1.53 | 610 | 3 | 0 |
Bharat Heavy Electricals Ltd. | 2010 | 1,168,998 | 0.49 | 2513 | 1 | 1 |
Godrej Consumer Products Ltd. | 2011 | 118,256 | 0.61 | 34 | 1 | 0 |
Tata Chemicals Ltd. | 2011 | 86,662 | 0.58 | 34 | 2 | 0 |
Piramal Enterprises Ltd. | 2011 | 69,996 | 0.59 | 34 | 3 | 1 |
H M T Ltd. | 2011 | 45,032 | 1.35 | 34 | 4 | 0 |
K S K Energy Ventures Ltd. | 2011 | 37,636 | 0.95 | 34 | 5 | 0 |
B A S F India Ltd. | 2011 | 25,692 | 0.15 | 34 | 6 | 0 |
Peninsula Land Ltd. | 2011 | 16,550 | 0.87 | 34 | 7 | 0 |
Texmaco Rail & Engg. Ltd. | 2011 | 12,729 | 2.68 | 34 | 8 | 0 |
Alembic Ltd. | 2011 | 9,760 | 2.59 | 34 | 9 | 0 |
I T I Ltd. | 2011 | 9,202 | 3.41 | 34 | 10 | 0 |
Balmer Lawrie & Co. Ltd. | 2011 | 8,876 | 2.94 | 34 | 11 | 0 |
Man Infraconstruction Ltd. | 2011 | 6,957 | 3.75 | 34 | 12 | 0 |
D C M Shriram Ltd. | 2011 | 6,678 | 2.77 | 34 | 13 | 0 |
Venky'S (India) Ltd. | 2011 | 5,971 | 3.75 | 34 | 14 | 0 |
Bombay Burmah Trdg. Corpn. Ltd. | 2011 | 5,537 | 3.25 | 34 | 15 | 0 |
T I L Ltd. | 2011 | 5,058 | 3.55 | 34 | 16 | 0 |
Nitin Fire Protection Inds. Ltd. | 2011 | 4,660 | 2.07 | 34 | 17 | 0 |
Jindal Cotex Ltd. | 2011 | 4,559 | 3.31 | 34 | 18 | 0 |
Texmaco Infrastructure & Holdings Ltd. | 2011 | 4,000 | 1.65 | 34 | 19 | 0 |
India Glycols Ltd. | 2011 | 3,473 | 1.12 | 34 | 20 | 0 |
Kokuyo Camlin Ltd. | 2011 | 3,239 | 1.04 | 34 | 21 | 0 |
Globus Spirits Ltd. | 2011 | 2,830 | 1.09 | 34 | 22 | 0 |
B S Ltd. | 2011 | 1,880 | 1.60 | 34 | 23 | 0 |
Technocraft Industries (India) Ltd. | 2011 | 1,758 | 0.68 | 34 | 24 | 0 |
From the above database, i have to create a dummy variable that takes the value '1' if the ESG company (e., the company with value '1' in the ESG column) has the highest 'synch' compared to other companies in the peer group.
Peer group definition is the same as I mentioned in the previous query
if the company is making ESG reporting, ( i.e., value is equal to '1'), identify the companies which are closer to ESG reporting companies based on their MCAP(market capitalization) as peer companies within each industry code. the closeness should be just below the ESG company MCAP and just above the ESG company MCAP in two levels
in some industry groups, we cannot find peer companies just above the MCAP of ESG companies, and also in some industries, only one company. in such case no peer company
the output should be in the following format
name | year | code | dummy |
Oil & Natural Gas Corpn. Ltd. | 2010 | 610 | 1 |
Piramal Enterprises Ltd. | 2011 | 34 | 1 |
Zee Entertainment Enterprises Ltd. | 2011 | 6020 | 0 |
hope I mentioned the conditions clearly. if any clarity is required on the conditions, please let me know.
i am attaching the .CSV file of the sample data
please suggest to me a SAS code to generate the above table
thanking you in advance
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.