BookmarkSubscribeRSS Feed
amanjot_42
Fluorite | Level 6

Hi guys,

I am new to SAS!

Actually, I was trying to limit my sample into those firms only which have data for both pre and post events in my sample. The event years are different for different firms. For instance, if event year of one firm is 2006, I want to see whether this firm has data for the previous five years and post five years or not. I don't want the firms to be having data for each of the pre-and post years. eve observation from pre- and one from post- would suffice my purpose. But they should have at least one in each if they don't then I want to delete those firms from my sample.

 Data look like:

Cusip Year Sales event_year

11000 2005 10  0

11000 2006  20  1

11000 2007  30  0

11000 2008  40  0

12000 2004  65  1

12000 2005  90  0

12000 2006  65  0

13000 2010  80  0

13000 2011  75  0 

13000 2012  95  1

14000 2008  65  0

14000 2009  45  0

14000 2010  70  1

14000 2011  90  0 

 

The years in bold are my event years, different for different firms. So according to the criteria, I don't want cusip codes 13000 and 12000 because they don't have data for either pre- or post event years. Please help me with the code!

Regards

Aman

1 REPLY 1

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 575 views
  • 0 likes
  • 2 in conversation