Login  Register

Re: How to calculate (sum) from multiple variable thru loop, if variable are not in sequential order

Posted by Art Kendall on Jul 13, 2022; 8:48pm
URL: http://spssx-discussion.165.s1.nabble.com/How-to-calculate-sum-from-multiple-variable-thru-loop-if-variable-are-not-in-sequential-order-tp5741009p5741013.html

*Your data does not have defined user missing values.

*You do not have labels so it is hard to know if the question posed is really what you want to know.  It is very possible a sum is not meaningful.

*Sysmis values have not been resolved.

one work around is this

SORT VARIABLES BY NAME (A).
compute MySum =SUM( Q6I_T_1 to Q6I_T_246, Q6I_T_1001 to Q6I_T_1068).
FREQUENCIES VARIABLES = MySum.

FREQUENCIES VARIABLES=Q6I_T_1016
  /STATISTICS= sum MINIMUM MAXIMUM STDDEV MEAN MEDIAN.

Art Kendall
Social Research Consultants