# Creating New Variables????

Discussion in 'SPSS' started by Allen, Nov 14, 2011.

1. ### AllenGuest

numeric var_per_1 to var_per_15 (f2.1).

vector A=phyabuse_sum to housing_sum.

vector B=var_per_1 to var_per_15.

loop #C=1 to 15.

if(A(#C) gt 0)B(#C)=(A(#C)/NumberOfChildren)*100.

end loop.

exe.

I can't find a solution in the FM for this, hence this post. I have
15 consecutive fields\variables as represented by vector A and I am
simply generating a simple percent associated with each of the 15
variables by dividing by the field\variable "NumberOfChildren". Each
compute will result in a percentage so I created a range of 15
variables to capture the percents but currently the percents are
generic. Is there a short way to create the 15 variables representing
the percentages which aren't generic, e.g., phyabuse_sum_percent
rather than var_per_1? In other words I'd like the vector B variable
names to be connected with the vector A field names, short of typing
out 15 field names.

Allen, Nov 14, 2011