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.

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

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
  • 3 replies
  • 1010 views
  • 13 likes
  • 4 in conversation