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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.