Hello,
When I try to set the next condition on the if statement that determines the value between 2 numbers, the result unfortunately does not take this condition into account and calculates it as there would be no such a condition:
else if ke ne 1 and sales = 0 and (0 < other < 50000000) then do;
What is wrong?
Thanks,
Stefan
Why not just omit the "between" logic and split into two conditions?
This seems to work fine for me.
Do you need to round/fuzz the 0 comparison?
data have;
do ke=0,1;
do sales=0 to 4;
do other=1000000 to 8000000 by 1000000;
output;
end;
end;
end;
run;
data want;
set have;
if ke ne 1 and sales = 0 and (0 < other < 50000000) then do;
flag=1;
end;
else flag=0;
run;
What does the code look like before the ELSE? You may never get to this "condition" because of prior code and values.
What is the value of KE, Sales and OTHER?
What is the calculation performed and values of the variables involved?
No data, incomplete code, no actual evidence of incorrect anything in this case.
Please do not chop stuff up and then expect us to mind read the contents of needed code and values of variables.
@Stepik wrote:
Hello,
When I try to set the next condition on the if statement that determines the value between 2 numbers, the result unfortunately does not take this condition into account and calculates it as there would be no such a condition:
else if ke ne 1 and sales = 0 and (0 < other < 50000000) then do;
What is wrong?
Thanks,
Stefan
@Stepik wrote:
Hello,
When I try to set the next condition on the if statement that determines the value between 2 numbers, the result unfortunately does not take this condition into account and calculates it as there would be no such a condition:
else if ke ne 1 and sales = 0 and (0 < other < 50000000) then do;
You haven't told us what you see in the output that seems to be incorrect. What do you see that you think is incorrect? Please be specific. Also please show us sample data.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.