04-21-2015 11:43 AM
I am trying to output natural numbers that are not divisible by 3 and 5 on SAS data step.
a= Mod(k,3)~=0 and a= Mod(k,5)~=0;
This is obviously not correct!
04-21-2015 11:58 AM
Maybe a tad simplier:
do a=0 to 100;
if mod(a,3) ne 0 and mod(a,5) ne 0 then output;
Your a= Mod(k,3)~=0 and a= Mod(k,5)~=0; was assigning a logical value to A based on comparing the first mod to 0 which yields a 0 or 1 depending true, then comparing the current value of a to mod(k,5) and then the 0. Since the logical comparisons always yield 0 or 1 in SAS terms you weren't getting what you want. And the specific operations generally result in False