DATA Step, Macro, Functions and more

macro comparison?

Reply
SAS Employee
Posts: 73

macro comparison?

%macro asd;

%let a=66.12345;
%let b=100;

%if &a < &b %then %put "True";
%else %put "False";

%mend asd;

%asd;



if i executed this code, instead of getting true, i am getting false. why?
i am expecting output as true.

how i can get true as output?


help me...

pavan.
Super User
Posts: 5,431

Re: macro comparison?

Posted in reply to Pavan_SAS
To do a comparison with floating point numbers, you have to use %sysevalf function:

%if %sysevalf(&a < &b) %then %put "True";
%else %put "False";

Regards,
Linus
Data never sleeps
SAS Employee
Posts: 73

Re: macro comparison?

thanks linus !
Ask a Question
Discussion stats
  • 2 replies
  • 108 views
  • 0 likes
  • 2 in conversation