BookmarkSubscribeRSS Feed
ZRick
Obsidian | Level 7

%put %eval( 1000.1 LE 1000.1);

how does sas treat 1000.1 in this case?

Why it becomes 1 when running sas.

2 REPLIES 2
ballardw
Super User

%EVAL generally only understands integers. The comparison value of the LE statement is what you have asked %EVAL to report. SAS will return 1 for true and 0 for false as it doesn't have an actuall Boolean data type. So 1000.1 is less than or equal to 1000.1 and the result is 1.

If you change to LT for strictly less than you would get a result of 0 since the comparison would be false.

Astounding
PROC Star

Also note ... because of the decimal point, %EVAL is forced to make a character comparison.  (As was noted, %EVAL can perform arithmetic with integers only.)  This expression would also return 1 because of the decimal point:

%eval( 9. > 80)

Since %sysevalf can perform non-integer arithmetic, this expression returns 0:

%sysevalf( 9. > 80)


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