Here is a snapshot of some original data (the dataset is much larger)
Here is a snapshot of the proc contents for this dataset (side question- how can DOLLAR16.2 be an informat?)
I'm doing this work in EG, and what I'm trying to attempt to do either in a program or query builder is compare the values of ApprovedMemberPay and ApprovePatientPayAmount and return rows where they don't match, so when I try comparing them right off the bat without doing anything to the variables but simply using the condition "where ApprovedPatientPayAmount ne ApprovedMemberPay" I get a dataset showing the same values (below), which is the opposite of what I want.
how can I change formats/informats to compare the two values correctly?
Try adding another variable:
difference = ApprovedMemberPay - approvedPatientPayAmount;
I suspect the values will be tiny, like 1E-15. If that turns out to be true, it will be helpful information for you to decide on the next step.
Most likely, you are already comparing the values correctly. But the report doesn't illustrate that because of the formats. It seems likely that the variables are different somewhere beyond the second digit after the decimal point.
To test that, remove the format in the new data set:
data want;
set have;
where ApprovedPatientPayAmount ne ApprovedMemberPay;
format ApprovedPatientPayAmount ApprovedMemberPay;
run;
By removing the formats, you will be able to see the actual values instead of the formatted values.
You can just remove the informats and formats.
eg.
informat ApprovedMemberPay;
format ApprovedMemberPay;
This is the code I used:
data want;
set data;
where ApprovedMemberPay ne ApprovedPatientPayAmount;
format ApprovedMemberPay ApprovedPatientPayAmount;
informat ApprovedMemberPay ApprovedPatientPayAmount;
run;
And I'm still getting results with same values (besides the ones that are 0):
Try adding another variable:
difference = ApprovedMemberPay - approvedPatientPayAmount;
I suspect the values will be tiny, like 1E-15. If that turns out to be true, it will be helpful information for you to decide on the next step.
@Astounding You're right, they turned out to be very small values; 8.88E-16, -5.32E-15...
Use the round() function to discard the small fractional values. These tiny values are artifacts of the way SAS stores and computes numerical values.
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 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.