Re: How to calculate (sum) from multiple variable thru loop, if variable are not in sequential order
Posted by PRogman on Jul 14, 2022; 6:31pm
URL: http://spssx-discussion.165.s1.nabble.com/How-to-calculate-sum-from-multiple-variable-thru-loop-if-variable-are-not-in-sequential-order-tp5741009p5741018.html
I am looking over your data set. You have 556 cases and 7735 variables.
The variable structure seems to have 5 initial unique names, then a block of variables starting with Q5_10_# thru Q67_T_#, where # changes from 2 to 246 and then from 1000 to 1068.
Maybe you are working in the wrong (wide) format. Some tasks are more difficult in the wrong database format. Do you have data in long format? If so, FILTER and AGGREGATE may solve your problems.
BTW, the variables SAT_NUM_AVA_# are not inte file.
Apparnet variable structure in Test.sav:
Initial 5 variables
SRL (not unique values, 162 duplicates)
Q6I_T_1
Q6II_T_1
Q7_T_1
Q67_T_1
then repeat # = [2...246, 1001...1068]
Q5_10_# Q5_20_#
Q6I_10_# Q6I_20_#
Q6II_10_# Q6II_20_#
Q7_10_# Q7_20_#
Q8A_# Q8B_#
Q9MN_1_# Q9YR_1_#
Q9MN_2_# Q9YR_2_#
Q9MN_3_# Q9YR_3_#
NUM_DIS_#
NUM_OOS_#
EXPIR_#
WT_DIS_#
WT_OOS_#
Q5_T_#
Q6I_T_# Q6II_T_#
Q7_T_# Q67_T_#
/PR