BookmarkSubscribeRSS Feed
srikanthyadav44
Quartz | Level 8

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

NameyearmcapsynchcodeRANKESG
Oil & Natural Gas Corpn. Ltd.20102,349,7651.6061011
Oil India Ltd.2010277,1600.5561020
Selan Exploration Technology Ltd.20106,6041.5361030
Bharat Heavy Electricals Ltd.20101,168,9980.49251311
Godrej Consumer Products Ltd.2011118,2560.613410
Tata Chemicals Ltd.201186,6620.583420
Piramal Enterprises Ltd.201169,9960.593431
H M T Ltd.201145,0321.353440
K S K Energy Ventures Ltd.201137,6360.953450
B A S F India Ltd.201125,6920.153460
Peninsula Land Ltd.201116,5500.873470
Texmaco Rail & Engg. Ltd.201112,7292.683480
Alembic Ltd.20119,7602.593490
I T I Ltd.20119,2023.4134100
Balmer Lawrie & Co. Ltd.20118,8762.9434110
Man Infraconstruction Ltd.20116,9573.7534120
D C M Shriram Ltd.20116,6782.7734130
Venky'S (India) Ltd.20115,9713.7534140
Bombay Burmah Trdg. Corpn. Ltd.20115,5373.2534150
T I L Ltd.20115,0583.5534160
Nitin Fire Protection Inds. Ltd.20114,6602.0734170
Jindal Cotex Ltd.20114,5593.3134180
Texmaco Infrastructure & Holdings Ltd.20114,0001.6534190
India Glycols Ltd.20113,4731.1234200
Kokuyo Camlin Ltd.20113,2391.0434210
Globus Spirits Ltd.20112,8301.0934220
B S Ltd.20111,8801.6034230
Technocraft Industries (India) Ltd.20111,7580.6834240

 

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 

nameyear code dummy
Oil & Natural Gas Corpn. Ltd.20106101
Piramal Enterprises Ltd.2011341
Zee Entertainment Enterprises Ltd.201160200

 

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 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 0 replies
  • 850 views
  • 0 likes
  • 1 in conversation