IBM Support

Using the value of Pi in SPSS Transformation commands

Troubleshooting


Problem

I need to use Pi, with as much precision as possible, in data transformation commands in SPSS. How can I do this without entering the known value (approximately 3.14) manually?

Resolving The Problem

You can use the fact that tan(Pi/4) = 1 with the ARTAN (inverse tan) function that is available in SPSS. SPSS returns a value equal to Pi/4 in (double precision) for the expression ARTAN(1). So you may simply use the expression

4*ARTAN(1)

as the expression of Pi in your transformation commands. If you are using Pi for 2 or more times in a set of transformations, it would be efficient to first create a variable that is equal to Pi and which you could delete before saving the data file.

COMPUTE PI = 4*ARTAN(1).

[{"Product":{"code":"SSLVMB","label":"IBM SPSS Statistics"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Not Applicable","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"Not Applicable","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Historical Number

18647

Document Information

Modified date:
16 April 2020

UID

swg21476209