I need help with a SAS code.
My table displays several contracts.
There is a column Expiring_Month, telling on which month the contract expires.
Plus, I have 4 variables Amount_N, Amount_R, Amount_RT, Amount_NT (each of these is divided for 12 months (so 48 columns), so they look like Amount_202001_N, Amount_202002_N, Amount_202003_N and so on till December). Moreover, there are other 4 columns Amount_MIN_N, Amount_MIN_R, Amount_MIN_RT, Amount_MIN_NT.
Basically, Amount_Min_N exists only if Amount_Min_R does not exist (and viceversa), while, Amount_2020XX_RT and Amount_2020XX_NT are valorised until the month before the Expiring_Month.
What I need to do is to give the value of Amount_Min_RT and Amount_Min_NT to the columns Amount_2020XX_R
(i should actually give values for 9 (Sep) 10 (Oct), 11 (Nov) 12 (Dec) as I have already data till August).
The first step I have done is the following (I only post Oct valorization, but i did for Nov and Dec):
data xox_sa_1;
set xox_sa;
*october;
if (amount_min_n > 0 and amount_min_r = .) then amount_202010_N = amount_min_n;
if (amount_min_n = . and amount_min_r > 0) then amount_202010_r = amount_min_r;
run;
Then, if for example there is a contract expired on May, the Amount_202005_RT (or Amount_202005_NT, it depends on the case) does not get valorised, but the variable Amount_202005_R (and the following Amount_202006_R, and so on) should get valorised with the Amount_Min_RT/Amount_Min_NT values.
I hope I made it clear ... does anyone have any idea?? I would need to take into consideration the expiring month, but I do not know how.