I have 31 columns/variables (v1, v2, v3...) that I want to standardize by (v1-mean(v1)) / std(v1) and save this new value into a new column v1_std.
Is there a single formula for this? I'm currently typing out 31 different formulas. At this point I'm tempted to export into Excel, create my new standardized variables, and then export them back. But for tracking and debugging purposes, I'd like to keep it all in SPSS if possible.
Right now, I have code that is:
DESCRIPTIVES VARIABLES=v1, v2, ..., v31
/STATISTICS=MEAN STDDEV.
compute v1_std = (v1 - 0.52)/0.701.
compute v2_std = (v2 ...
I'm reading 0.52 (mean) and 0.701 (std dev) off the descriptive variables outcome and manually typing this into 31 different compute formulas.
Well of course there are easier ways to calculate this all automatically, but in this case you wouldn't even need to do that - just use the
/savesubcommand in the descriptives:This will calculate a new variable for each of the original ones - containing the standardized values.