data test;
x=2**3;
y=0**0;
run;
Results:
x=8
y=.
In the log as for y: NOTE: Invalid argument(s) to the exponential operator "**".
In another software (tested in R): 0**0 = 1
Question: How to weite this in SAS to get 1 as the result?
Well, it's not equal to 1 according to many authorities, it has no agreed upon value, so SAS is giving a reasonable answer, as is R.
According to Wikipedia:
The debate over the definition of has been going on at least since the early 19th century. At that time, most mathematicians agreed that , until in 1821 Cauchy[13] listed along with expressions like in a table of indeterminate forms
The debate between Cauchy and Libri got rather heated.
And as everyone knows, I never disagree with Augustin-Louis Cauchy.
Wow, so Twitter has been going since 1831! You learn something new every day
Hi @oves,
If need be, you could define your own power function and use this in place of the exponential operator:
proc fcmp outlib=work.funcs.test;
function pow(x, y);
z=if x=y=0 then 1 else x**y;
return(z);
endsub;
run;
options cmplib=work.funcs;
data test;
input a b;
c=pow(a,b);
cards;
2 3
0 0
;
@PaigeMiller: Hilarious! 🙂 This beats "y=(.1+.2-.3)**0;" as a fun answer to @oves's question.
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.