Solved
New Contributor
Posts: 2

Frustrated Newbie Question

I am sure I'm missing something simple that I've been told about before, but for the life of me I can't figure out what it is, and the failure of a simple filter is frustrating me.

I am attempting to compare two reported quantities dispensed from different sources, looking for instances where the quantities do not match, but quantity 1 multiplied by a known package size equals quantity 2.  For example, Pharmacy A says they dispensed 3 bottles of a certain drug.  Each bottle contains 100 pills. The suppliers shows that Pharmacy A dispensed 300 of the drug.  Well 3 * 100 = 300, and for my purposes this is good and I can forget about this line item.  This is the basic logic of my query, and it work so long as the quantities reported are whole numbers, but anytime there is a decimal involved, my filter is returning the line item saying the quantities are not equal.  I have output all the variables involved, including calculated values, so I can see what is being compared, and I don't get it.  For some reason 90 = 90, 120 = 120, but 7.2 != 7.2.  I hope somebody has an answer for me because I'm at a loss.

Chris

Accepted Solutions
Solution
‎01-15-2013 03:54 PM
Community Manager
Posts: 3,452

Re: Frustrated Newbie Question

Probably best to use the ROUND function on these values before comparison.  For more about numerical precision, see:

SAS(R) 9.2 Language Reference: Concepts, Second Edition

And for exhaustive detail:

Numerical precision in SAS

Chris

All Replies
Solution
‎01-15-2013 03:54 PM
Community Manager
Posts: 3,452

Re: Frustrated Newbie Question

Probably best to use the ROUND function on these values before comparison.  For more about numerical precision, see:

SAS(R) 9.2 Language Reference: Concepts, Second Edition

And for exhaustive detail:

Numerical precision in SAS

Chris

New Contributor
Posts: 2