Hello!
I'm just starting to learn SAS, I have a seemingly straightforward logic that I don't know how to execute. If possible, would you please provide me an Example coding?
What I need to do is:
If within the same code, Interest(t+1)is less than Interest(t), then output coupon=interest(t), keep date, code. In the example below, it is observation 6.
obs.    date    code    interest
1   1/1/2015    1   0.2
2   1/2/2015    1   0.5
3   1/3/2015    1   1.9
4   1/4/2015    1   2.5
5   1/5/2015    1   3.8
6   1/1/2015    2   2.1
7   1/2/2015    2   0
8   1/3/2015    2   0.1
9   1/4/2015    2   0.2
10  1/5/2015    2   0.3
output sample should look like either:
obs.    date    code    interest  coupon
1       1/1/2015     2    2.1      2.1
or
obs.    date    code    interest  coupon
1   1/1/2015    1        0.2
2   1/2/2015    1        0.5
3   1/3/2015    1        1.9
4   1/4/2015    1        2.5
5   1/5/2015    1        3.8
6   1/1/2015    2        2.1       2.1
7   1/2/2015    2        0
8   1/3/2015    2        0.1
9   1/4/2015    2        0.2
10  1/5/2015    2        0.3