Hello everyone.
I hope you are doing very well.
there are several food items. two questions are asked about each of them. One was asked about their consumed amount in a reference period. The next one is a categorical variable which is asked about the source of those foods. So the question is I want to get the amount of each item by the categories of categorical variable in a short command.
the sample of data is as below. q_23_8_* are sources of foods and q_23_9_* are the consumed amounts of foods. the letters (a-e) at the end of questions names represent the food names.
I hope you are doing very well.
there are several food items. two questions are asked about each of them. One was asked about their consumed amount in a reference period. The next one is a categorical variable which is asked about the source of those foods. So the question is I want to get the amount of each item by the categories of categorical variable in a short command.
the sample of data is as below. q_23_8_* are sources of foods and q_23_9_* are the consumed amounts of foods. the letters (a-e) at the end of questions names represent the food names.
| q_23_8_a | q_23_9_a | q_23_8_b | q_23_9_b | q_23_8_c | q_23_9_c | q_23_8_d | q_23_9_d | q_23_8_e | q_23_9_e |
| Purchased | 3 | own production | 1 | Purchased | 22 | own production | 120 | Purchased | 2 |
| own production | 1 | Purchased | 2.5 | Purchased | 28 | borrowed | 20 | Bartered | 15 |
| Bartered | 2 | Bartered | 1 | Bartered | 13 | Purchased | 50 | Purchased | 7 |
| borrowed | 4 | own production | 0.6 | own production | 3 | Bartered | 20 | Purchased | 3 |
| Bartered | 1.5 | Purchased | 0.5 | Purchased | 14 | Bartered | 14 | own production | 8 |
| food aid | 1.2 | Purchased | 1.2 | food aid | 16 | Purchased | 30 | food aid | 10 |
| own production | 10 | Bartered | 3 | own production | 21.5 | food aid | 45 | borrowed | 6 |
| food aid | 1.2 | food aid | 0.6 | Purchased | 49 | Purchased | 65 | Purchased | 11 |
| borrowed | 1 | Purchased | 2 | Purchased | 3 | own production | 45 | own production | 9 |

Comment