BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.

Here is a snapshot of some original data (the dataset is much larger)

 

PayAmountOGValues.PNG

 

Here is a snapshot of the proc contents for this dataset (side question- how can DOLLAR16.2 be an informat?)

 

PayAmount.PNG

 

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.

 

PayAmountResults.PNG

 

how can I change formats/informats to compare the two values correctly?

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

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.

View solution in original post

6 REPLIES 6
Astounding
PROC Star

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.

evp000
Quartz | Level 8

You can just remove the informats and formats. 

eg.

informat ApprovedMemberPay;

format ApprovedMemberPay;

 

 

 

JediApprentice
Pyrite | Level 9

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):

 

AppResults.PNG

Astounding
PROC Star

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.

JediApprentice
Pyrite | Level 9

@Astounding You're right, they turned out to be very small values; 8.88E-16, -5.32E-15...

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1386 views
  • 2 likes
  • 4 in conversation