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)
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.
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.
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.
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 (**).
got it! there is no function.
you need to do:
variable1 ** variable2;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With