naturally treated as 0's?
@edasdfasdfasdfa wrote:
naturally treated as 0's?
No they are treated naturally as missing. So depending on what you are doing the result is what your would normally expect.
So simple operators, like +-*/, will generate a missing values as a result of operating on one or more missing values.
But more complex operations like MIN(), MAX(), SUM(), MEAN() will work appropriately. So if your data values are
1 . 2 3 4
The SUM() will be 10, but the MEAN() will be 10/4 = 2.5 and NOT 10/5=2 since the missing values does not contribute.
No. Missing values are treated as less than any number you think of in SAS. Including zero.
Hi @edasdfasdfasdfa For all I know,0 isn't missing. Missing values are valid values that does not have a value in other words a blank value.
Using operator(arithmetic) propagates missing values while functions ignore missing values.
"I was wondering if this was the default behavior?"-- No default is just plain missing as-is
"but how we would go about setting numeric missing to zero?"
Do you mean this? options missing=0;
options missing=0;
data w;
k=.;
run;
@edasdfasdfasdfa wrote:
Thanks, Novinorsin.
No doubt that missing values might be valuable and are not the same as 0's..but how we would go about setting numeric missing to zero? I was wondering if this was the default behavior?
You've gotten many responses about the behavior of missing values, but it sounds like you're asking how to set numeric missing to zero. Perhaps this previous post is what you're looking for:
Using operator(arithmetic) propagates missing values while functions ignore missing values.
What if you use a function with an operator?
Ie sum(of var1-var9) ?
should your operands(variable values) are all missing, of course you would get the result as missing too, otherwise, the propagation of missing values doesn't occur when you use functions. For example,
options missing=0;
data w;
k=sum(.,.,.,.,20);
k1=sum(.,.,.,.,.,.);
k2=.+.+.+20;
run;
options missing=.;
data w;
k=sum(.,.,.,.,20);
k1=sum(.,.,.,.,.,.);
k2=.+.+.+20;
run;
@edasdfasdfasdfa wrote:
naturally treated as 0's?
No they are treated naturally as missing. So depending on what you are doing the result is what your would normally expect.
So simple operators, like +-*/, will generate a missing values as a result of operating on one or more missing values.
But more complex operations like MIN(), MAX(), SUM(), MEAN() will work appropriately. So if your data values are
1 . 2 3 4
The SUM() will be 10, but the MEAN() will be 10/4 = 2.5 and NOT 10/5=2 since the missing values does not contribute.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.