Raised to Power in SAS – Power Function in SAS – square squareroot ,cube, cuberoot

Raised to the power in SAS is achieved by using ** as shown below. Let’s see an example on how to Get the Square of the column in SAS.  Get the Squareroot of the column in SAS. Get the cube of the column in SAS. Get the cuberoot of the column in SAS. Power Function in SAS in roundabout way.

  • Raised to Power in SAS – Square of the column in SAS
  • Raised to Power in SAS – Squareroot of the column in SAS
  • Raised to Power in SAS – cube of the column in SAS
  • Raised to Power in SAS – Cuberoot of the column in SAS

Syntax:

 Variable ** N

Raises N to the power of variable.
Raised to Power in SAS – Power Function in SAS - square squareroot ,cube, cuberoot 0a

So we will be using STUD_DET Table in our example

Raised to Power in SAS – Power Function in SAS - square squareroot ,cube, cuberoot 1

 

 

Raised to the power in SAS: Square of the column in SAS

Raised to the power in SAS is achieved by using **. Square of the column in SAS is calculated by using **. A variable followed ** followed by 2 will find the square of the column in SAS as shown below

/* square of column */ 

Data stud_det1; 
set stud_det; 
grade_square = Grade ** 2; 
run;

So the resultant table with square of the column calculated will be

Raised to Power in SAS – Power Function in SAS - square squareroot ,cube, cuberoot 2

 

 

Raised to the power in SAS: Cube of the column in SAS

Raised to the power in SAS is achieved by using **.  Cube of the column in SAS is calculated by using **.  A variable followed ** followed by 3 will find the cube of the column in SAS as shown below

/* cube of column */ 

Data stud_det1; 
set stud_det; 
grade_cube = Grade ** 3; 
run; 
 

So the resultant table with cube of the column calculated will be

Raised to Power in SAS – Power Function in SAS - square squareroot ,cube, cuberoot 3

 

 

Raised to the power in SAS: Squareroot of the column in SAS

Squareroot of the column in SAS is calculated by SQRT() function. SQRT() function takes column name as argument will find the square of the column in SAS as shown below

/* squareroot of column */ 

Data stud_det1; 
set stud_det; 
grade_squareroot = sqrt(Grade); 
run; 
 

So the resultant table with squareroot of the column calculated will be
Raised to Power in SAS – Power Function in SAS - square squareroot ,cube, cuberoot 4

 

 

Raised to the power in SAS: Cuberoot of the column 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.

/* cuberoot of column */ 

Data stud_det1; 
set stud_det; 
grade_cuberoot = (Grade) ** (1/3); 
run; 

So the resultant table with cuberoot of the column calculated will be

Raised to Power in SAS – Power Function in SAS - square squareroot ,cube, cuberoot 5

 

                                                                                                 

Author

  • Sridhar Venkatachalam

    With close to 10 years on Experience in data science and machine learning Have extensively worked on programming languages like R, Python (Pandas), SAS, Pyspark.

    View all posts