Hi Community,
I am working on a project and need to make some adjustments to a SAS code written by a good SAS programmer and need some of your help to add 2 more conditions.
To the following code I need to add two things:
1. If the P_code in 107, 108,109,110 then exlude from the calculation UFA=round(UFR*increase,0.01);
2. UFA = balance on opendate minus O_balance 5 days after opening date.
The existing conditions in the following code applies now and going forward however conditions 1 & 2 that are mentioned above must take place after January 01 2019
data work.eom_processed;
set work.eom;
if "&StartM."d <= OpenDate <= "&EndM."d
or (ChgFlag='F' and put(strip(put(pcode,4.)),$pc3l.)='LOC') then do;
if L_Amt in (0,.) then Reason='NF';
else do;
if RW_Ind='Y' then do;
if B_Ind='Y' or (B_Ind ne 'Y' and pct_increase < 0.3) then do;
UFA=round(UFR*increase,0.01);
if pct_increase < 0 then do;
Reason='RW < Original';
C_Ind='Y';
UFA=0;
end;
end;
else do;
UFA=0;
Reason='Over 30%';
end;
end;
else UFA=round(UFR*L_Amt,0.01);
if TBRatio <= TBBonusMax
then TBBonusAmt=round(min(TBBonusLimit, L_Amt)*TBBonusRate,0.01);
end;
end;
Grateful for your help.
Kind regards,
Magstar
I feel you need add your conditions within next code:
if RW_Ind='Y' then do;
if B_Ind='Y' or (B_Ind ne 'Y' and pct_increase < 0.3) then do;
UFA=round(UFR*increase,0.01);
if pct_increase < 0 then do;
Reason='RW < Original';
C_Ind='Y';
UFA=0;
end;
end;
..................
but I'm not sure I understand exactly what you mean.
Should OpenDate or run date be January 1st 2019 and on in order to use the new conditions?
First condition can be entered as:
if RW_Ind='Y' then do;
if B_Ind='Y' or (B_Ind ne 'Y' and pct_increase < 0.3) then do;
if <date> LT '01JAN2019'd
then UFA=round(UFR*increase,0.01);
else if P_code not in (107, 108,109,110)
then UFA=round(UFR*increase,0.01);
..........
Condition 2 is unclear - What do you mean by O_balance? is this a variable in work.eom data set ?
Do you mean that abs(opendate - O_balance) LE 5 ? or without ABS function?
Hi Shmuel,
Thanks for your reply.
Please disregard my posting.
Definitions have changed and what I have posted earlier does not apply any longer.
Kind regards.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.