Dear all
I have 3 variables in long format.
1. pid
2. qnum - question number (1-16)
3. asthq - binary response to qunum
I would like to create a new variable to indicate a particular response pattern within id over the variable asthq (e.g., 0=all zeroes, and so forth).
I would be grateful for any advice on how to do this.
I have 3 variables in long format.
1. pid
2. qnum - question number (1-16)
3. asthq - binary response to qunum
I would like to create a new variable to indicate a particular response pattern within id over the variable asthq (e.g., 0=all zeroes, and so forth).
I would be grateful for any advice on how to do this.
Code:
+--------------------+
| pid qnum asthq |
|--------------------|
1. | 1 1 Yes |
2. | 1 2 Yes |
3. | 1 3 No |
4. | 1 4 No |
5. | 1 5 No |
|--------------------|
6. | 1 6 No |
7. | 1 7 No |
8. | 1 8 No |
9. | 1 9 Yes |
10. | 1 10 Yes |
|--------------------|
11. | 1 11 Yes |
12. | 1 12 No |
13. | 1 13 Yes |
14. | 1 14 Yes |
15. | 1 15 No |
|--------------------|
16. | 1 16 Yes |
17. | 2 1 Yes |
18. | 2 2 Yes |
19. | 2 3 Yes |
20. | 2 4 Yes |
|--------------------|
21. | 2 5 Yes |
22. | 2 6 Yes |
23. | 2 7 Yes |
24. | 2 8 Yes |
25. | 2 9 Yes |
|--------------------|
26. | 2 10 Yes |
27. | 2 11 Yes |
28. | 2 12 Yes |
29. | 2 13 Yes |
30. | 2 14 Yes |
+--------------------+

Comment