Desktop productivity for business analysts and programmers

Frustrated Newbie Question

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

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.

Thanks in advance.

Chris


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

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

View solution in original post


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

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

Re: Frustrated Newbie Question

Thank you very much.

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 190 views
  • 0 likes
  • 2 in conversation