BookmarkSubscribeRSS Feed
oves
Fluorite | Level 6

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?

3 REPLIES 3
PaigeMiller
Diamond | Level 26

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.

 

2019-05-20 15_48_38-Fake Tweet,Chat & Facebook Status Generator _ Prank Me Not.png

And as everyone knows, I never disagree with Augustin-Louis Cauchy.

--
Paige Miller
SASKiwi
PROC Star

Wow, so Twitter has been going since 1831! You learn something new every day Smiley Wink

FreelanceReinh
Jade | Level 19

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.

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!

How to Concatenate Values

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 3 replies
  • 1171 views
  • 13 likes
  • 4 in conversation