BookmarkSubscribeRSS Feed
Mistletoad
Calcite | Level 5

Hi,

 

A have a dataset with a list of transaction dates for different companies.

	transactiondate month lpermno gvkey fyear
1	04/29/1998	4	42455	005697	1998
2	04/30/1998	4	42455	005697	1998
3	05/05/1998	5	42455	005697	1998
4	05/06/1998	5	42455	005697	1998
5	05/07/1998	5	42455	005697	1998
6	03/01/1999	3	42455	005697	1999

I want to determine the first quarterly reporting date after the transactiondate. I have a separate dataset that shows this information.

 

gvkey fyearq fqtr(quarter) rdq(quarterly reporting date)
23 001000 1971 3 19711109 24 001000 1971 4 19720406 25 001000 1972 1 19720420 26 001000 1972 2 19720724 27 001000 1972 3 19721017 28 001000 1972 4 19730215

Ideally I want the first quarterly reporting date after the transaction date as a column in the first dataset.

I am thinking that I match on gvkey and fyear=fyearq and someone delete the observations in the second dataset that has a rdq before the transaction date and then retain the first rdq after the transaction date.

 

Thanks

2 REPLIES 2
PaigeMiller
Diamond | Level 26

First quarterly reporting date after a transaction date:

 

first_quarterly_date_after = intnx('quarter',transaction_date,1,'b');

This assumes transaction_date is an actual SAS date, meaning it is the number of days since 01JAN1960.

--
Paige Miller

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
  • 2 replies
  • 375 views
  • 0 likes
  • 3 in conversation