Jessica
Jessica

Reputation: 11

Save a value into a variable and then use it

I need to calculate the percentile 85 and then save in a variable because I want to use it in many condition sentences like:

IF(variable>percentile85) a=0.
IF(variable2>percentile85) b=0.
IF(variable3>percentile85) c=0.

Is there a way to save a value into a variable and then use it?

Upvotes: 0

Views: 145

Answers (2)

JKP
JKP

Reputation: 5417

Note that you can actually use Python in SPSS. The downloadable Programming and Data Management book has many examples. The SPSSINC TRANS extension command makes it particularly easy to do data transformations using Python code.

Upvotes: 0

eli-k
eli-k

Reputation: 11310

use RANK command with Ntiles, then use the new variable created:

RANK VARIABLES=YourVar(A) /NTILES(100).
IF(NYourVar>=85) a=0.
EXECUTE.

Upvotes: 1

Related Questions