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

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

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisHemedinger
Community Manager

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

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.

View solution in original post

2 REPLIES 2
ChrisHemedinger
Community Manager

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

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
Chris_Smith
Calcite | Level 5

Thank you very much.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 2 replies
  • 691 views
  • 0 likes
  • 2 in conversation