Tip 1, make your code nice and readble, this is more important than what it actually does in most cases:
data work.a;
set b;
if _n_=1 then count=0;
count=count + ifn(x not in (.,0),1,0);
run;
Note the consistent casing, and the indentations, and also the use of the code window (either {i} above your post or the SAS one). I would also avoid naming datasets a and b.
Tip 2, post test data in the form of a datastep:
https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712
Remember we cannot see your computer, we don't know what your data looks like.
... View more