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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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