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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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