BookmarkSubscribeRSS Feed
hhchenfx
Rhodochrosite | Level 12

Hi Everyone,

I use proc expand to get Max value of price. I know for sure that, the max value of price is 147212 and proc expand return the same value. 

proc expand data=M1 out=M1;
by tic;
convert price=price_top_&window/transformout=(MOVmax &window );
run;

However, when I check the condition below, SAS doesn't return top=1 for the record with highest price.

 

if price = price_top_&window then top=1;

After some checking, it turns out that, some how the price_top_&window is fractional greater than 147212. 

When I take Price - price_top_&window, SAS return value -2.91038E-11, which is -0.0000000000291038

All of my data are integer.

I wonder how that happens and how to fix it.

Thank you,

 

 

 

 

 

1 REPLY 1
Reeza
Super User
Numeric Precision issue.

if round(price,1) = round(price_top_&window, 1) then top=1;

Lookup the round function to find the nearest level of precision that you would like to match on.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 1 reply
  • 741 views
  • 0 likes
  • 2 in conversation