I have to create a table that shows average values of each variable DT06_1-DT06_19 (caution: I only have variables DT06_1-DT06_3, DT06_7, DT06_10-DT06_19.
The averages shall be computed by group. I have four groups shown in insuff_suff_res_cat (caution: not every participant shows values for each of the four categories. I dont have rows where the participant shows values for a category).
And last, the averages on each DT06-variable shall only be computed where the respective DT01-variable shows the value “1” instead of “0”.
So together: For each group of the variable “insuff_suff_res_cat”, please calculate the average value of each DT06-variable only if the respective DT01-variable == “1”.
my dataset:
ID insuff_suff_res_cat DT01_1 DT01_2 DT01_3 DT01_4 DT01_5 DT01_6 DT01_7 DT01_8 DT01_9 DT01_10 DT01_11
1 poHYvL not_enough_resources 0 0 0 0 1 0 0 0 0 0 0
2 FgKAdE not_enough_resources 0 0 0 1 1 1 1 0 0 1 0
3 34HEg4 not_enough_resources 0 0 0 0 0 0 0 0 0 0 1
4 poHYvL not_enough_resources_help 0 0 0 0 1 0 0 0 0 0 0
5 FgKAdE not_enough_resources_help 0 0 0 1 1 1 1 0 0 1 0
6 34HEg4 not_enough_resources_help 0 0 0 0 0 0 0 0 0 0 1
DT01_12 DT01_13 DT01_14 DT01_15 DT01_16 DT01_17 DT01_18 DT01_19 DT06_1 DT06_2 DT06_3 DT06_7 DT06_10 DT06_11 DT06_12
1 0 0 0 0 0 0 0 0 <NA> <NA> <NA> <NA> <NA> <NA> <NA>
2 0 1 0 0 0 0 0 0 <NA> <NA> <NA> 0 0 <NA> <NA>
3 0 0 0 0 0 0 0 0 <NA> <NA> <NA> <NA> <NA> 0 <NA>
4 0 0 0 0 0 0 0 0 <NA> <NA> <NA> <NA> <NA> <NA> <NA>
5 0 1 0 0 0 0 0 0 <NA> <NA> <NA> 0 0 <NA> <NA>
6 0 0 0 0 0 0 0 0 <NA> <NA> <NA> <NA> <NA> 0 <NA>
DT06_13 DT06_14 DT06_15 DT06_16 DT06_17 DT06_18 DT06_19
1 <NA> <NA> <NA> <NA> <NA> <NA> <NA>
2 0 <NA> <NA> <NA> <NA> <NA> <NA>
3 <NA> <NA> <NA> <NA> <NA> <NA> <NA>
4 <NA> <NA> <NA> <NA> <NA> <NA> <NA>
5 0 <NA> <NA> <NA> <NA> <NA> <NA>
6 <NA> <NA> <NA> <NA> <NA> <NA> <NA>
I have already tried to apply the summarize command but I really can’t find a solution to connect it to my conditions. Any help appreciated.