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

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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