Skip to content

COMPUTE

Creates or overwrites a variable from an expression.

COMPUTE target = expression.
Kind Transformation (pending until data is needed)
Body free-form body
Changes data yes, undoable
COMPUTE bmi = weight / (height / 100) ** 2.
COMPUTE mean_q = MEAN.3(q1 TO q5).
STRING full (A40).
COMPUTE full = CONCAT(RTRIM(first), ' ', last).
  • New numeric targets are created as F8.2 and start as system-missing for every case. New string targets must be declared first with STRING.
  • Overwriting an existing variable keeps its labels and missing-value definition.
  • Names starting with # are scratch variables and are discarded after the data pass.
  • Arithmetic involving a missing value gives system-missing. Division by zero and invalid arguments (SQRT(-1)) give system-missing plus a warning count.

IF, RECODE, COUNT, EXECUTE


Generated from OrcStat’s command registry and reference. To suggest a change, open an issue.