BookmarkSubscribeRSS Feed
deleted_user
Not applicable
a=3+.;
b=.+.;
c=sum(3,.);
d=sum(.,.);
what will the result? how it comes? please explain
Thanks in advance.
1 REPLY 1
Cynthia_sas
SAS Super FREQ
Hi:
To find the results, you need to put the statements in a DATA step program. The program code and results are shown below from the SAS log:
[pre]
1077 data testsum;
1078 a=3+.;
1079 b=.+.;
1080 c=sum(3,.);
1081 d=sum(.,.);
1082 put _all_;
1083 run;

NOTE: Missing values were generated as a result of performing an operation on missing values.
Each place is given by: (Number of times) at (Line):(Column).
1078:4 1079:4
a=. b=. c=3 d=. _ERROR_=0 _N_=1
NOTE: Missing values were generated as a result of performing an operation on missing values.
Each place is given by: (Number of times) at (Line):(Column).
1 at 1081:3
NOTE: The data set WORK.TESTSUM has 1 observations and 4 variables.
NOTE: DATA statement used (Total process time):
real time 0.07 seconds
cpu time 0.00 seconds

[/pre]

The SUM function returns the sum of non-missing values, as clearly explained in the documentation:
http://support.sas.com/documentation/cdl/en/lrdict/62618/HTML/default/a000245953.htm

The documentation on assignment statements also explains how missing values are treated when you work with arithmetic operators in an assignment statement:
http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/a001334675.htm
In particular, look for the section entitled "Propagation of MIssing Values", where it states that:
"When you use a missing value in an arithmetic expression, SAS sets the result of the expression to missing. If you use that result in another expression, the next result is also missing. In SAS, this method of treating missing values is called propagation of missing values."


cynthia

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 765 views
  • 0 likes
  • 2 in conversation