Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SAS function for using 'power' / exponential

Tags:

exponent

sas

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)

like image 304
Allan Bowe Avatar asked Oct 21 '09 11:10

Allan Bowe


People also ask

How do you do exponents in SAS?

Raised to the power in SAS is achieved by using **. Cuberoot of the column in SAS is calculated by using **. A variable followed ** followed by (1/3) will find the cuberoot of the column in SAS as shown below.

What does exp () do in SAS?

The EXP function raises the constant e, which is approximately given by 2.71828, to the power that is supplied by the argument. The result is limited by the maximum value of a double decimal value on the computer.

How do you write squared in SAS?

You need a SAS data step to compute a variable that has new values. data import2; set import1; x2=x**2; run; An even simpler approach is to NOT explicitly compute x**2 by yourself prior to the regression, and to use PROC GLM for the regression, which will compute x**2 internally in the procedure.

How do you use square root in SAS?

In SAS, you calculate the square root of a number with the SQRT function. This function has one argument, namely a number, and returns its square root. Alternatively, you can find the square root by raising a number to 1/2. In SAS, you raise a number to a given power with the double-asterisk (**).


1 Answers

got it! there is no function.

you need to do:

variable1 ** variable2;

like image 127
Allan Bowe Avatar answered Oct 13 '22 13:10

Allan Bowe