I was wondering if someone can help me with this coding question:
This is the data I have:
Firm Quarter Earnings announcement date Sequence
A 1 20000416 1
B 1 20000420 2
C 1 20000425 3
D 1 20000430 4
A 2 20000720 1
B 2 20000723 2
C 2 20000726 3
D 2 20000730 4
.
.
.
In the example, I have two set of data. One consists of firms who announced earnings in Q1, and another consists of firms who announced earnings in Q2. In each set of the data, firms are listed in the order based on their earnings announcement date. Now for each late announcer, I want to create several edates that capture the earnings announcement dates of early announcers. Detailed as follows:
Firm Quarter Earnings announcement date Sequence edate1 edate2 edate3
A 1 20000416 1 . . .
B 1 20000420 2 20000416 . .
C 1 20000425 3 20000416 20000420 .
D 1 20000430 4 20000416 20000420 20000425
A 2 20000720 1 . . .
B 2 20000723 2 20000720 . .
C 2 20000726 3 20000720 20000723 .
D 2 20000730 4 20000720 20000723 20000726
.
.
.
Thank you in advance!
Two questions:
1) Why do you want to do this? It is rarely a good idea to structure data like this and there is probably a better way.
2) Do you have 2 data sets or 1? You post your data like it is 1 data set but you describe 2 data sets?
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 16. Read more here about why you should contribute and what is in it for you!
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.