Question

I may be missing something obvious, but how do you calculate 'powers' in SAS?

Eg X squared, or Y cubed?

what I need is to have variable1 ^ variable2, but cannot find the syntax... (I am using SAS 9.1.3)

Was it helpful?

Solution

got it! there is no function.

you need to do:

variable1 ** variable2;

OTHER TIPS

data t;
  num = 5;
  pow = 2;
  res = num**pow;
run;
proc print data = t;
run;

Use the POWER function and, if necessary, the CONSTANT function.

nbr_squared = power(nbr, 2);
nbr_cubed = power(nbr, 3);
E_to_the_power_2 = power(constant('E'),2);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top