Hi,
I currently have the below code
if Balance = F_Balance
then Balance_check = 1; else
if Balance = round(F_Balance + Balance_Difference,0.02)
then Balance_check = 1; else
Balance_check = not_OK;
I am currently checking over 500 fields, all pass apart from 1 row which shows
Balance = 897.61
F_balance = 897.02
Balance_Difference = 0.59
now this should pass however it keeps failing check as it should populate Balance_check with a value of 1 however its blank
"1" repesents pass
"blank" repesents fail
I have even tried removing the rounding 0.02 and still fails this one row, my dataset looks correct but i dont know where i am going wrong, also all fields are numeric formatting
I would say there is a problem with your numeric data (maybe not rounded?). This is a good examplpe of where posting test data to show what you have would be a good idea. As from what you have posted:
data test; balance=897.61; f_balance=897.02; balance_difference=0.59; balance_check=ifn(balance=f_balance or balance=round(f_balance+balance_difference,0.02),1,.); run;
Works fine for me. Note I simplified your if/else logic somewhat. Maybe try rounding balance (in fact round each of the values involved):
Why would you round to the nearest 2 cents, and expect there to be a match? You could try changing 0.02 to 0.01 and round to the nearest penny.
Secondarily, do you really have a variable named "NOT_OK"? (If not, just what are you trying to insert into the numeric variable BALANCE_CHECK?)
I would say there is a problem with your numeric data (maybe not rounded?). This is a good examplpe of where posting test data to show what you have would be a good idea. As from what you have posted:
data test; balance=897.61; f_balance=897.02; balance_difference=0.59; balance_check=ifn(balance=f_balance or balance=round(f_balance+balance_difference,0.02),1,.); run;
Works fine for me. Note I simplified your if/else logic somewhat. Maybe try rounding balance (in fact round each of the values involved):
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.