Hi All,
I am trying to execute the following code. It works fine when I change the "not =" to an "='" Sign. But I do not understand why not = is not working.
%MACRO Combine_and_Transpose(REG);
%if %eval( "&Reg." not = "ALL") %then
%let Group_vars = %STR(ACCOUNT_NAME);
%Else %let Group_vars = %STR(REGION PU9 GROUP_NAME ACCOUNT_NAME INSUTYPE);
%Mend;
%Combine_and_Transpose(®.);
Run;
Error Message -
ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was:
"MAS" not = "ALL"
ERROR: %EVAL function has no expression to evaluate, or %IF statement has no condition.
ERROR: The macro COMBINE_AND_TRANSPOSE will stop executing.
try using "ne".
try using "ne".
Thanks a lot ... i like the NE compared to ^= :smileygrin: but both shud work i believe. ..
Wish sas had used the <> symbol
SAS does use the <> operator but it is NOT the same as the NE operator.
In base SAS and IML it means take the maximum value.
So result of 0 <> -3 is 0 .
Just put the NOT outside the comparison. Also %EVAL() is not needed.
Instead of %if %eval( "&Reg." not = "ALL") %then
use %if not ( "&Reg." = "ALL") %then
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.