I need to run below in SPSS:
if (event_duration = 0) Acti_Activity = Activity.
if (event_duration = 1) Acti_Activity = MEAN (Activity, Activity_1).
if (event_duration = 2) Acti_Activity = MEAN (Activity, Activity_1, Activity_2).
... up to...
if (event_duration = 120) Acti_Activity = MEAN
(Activity, Activity_1, Activity_2, Activity_3, Activity_4, Activity_5, Activity_6, Activity_7, Activity_8, Activity_9, Activity_10,
Activity_11, Activity_12, Activity_13, Activity_14, Activity_15, Activity_16, Activity_17, Activity_18, Activity_19..... ,Activity_120
Essentially, I need a macro that "If event_duration = X, means Activity variables before Activity_X."
I have to do this on 15 variables, so although I could type them all, I assume there is some code that will simplify it?
source
share