I want to create a categorical variable called 'climateshock' from ten dummy variables. The each dummy variable represents a kind of climate shock. These dummy variables were created from a multiple choice question which asked the respondent to choose what kind of climate shock they experienced in last five years. I want to create a categorical variable to account for every kind of climate shock that were chosen by a respondent. For example, in the observation 3 below variable clsh5 and clsh8 were observed. I want to create the categorical variable in a way which will observe both clsh5 & clsh8 for the observation 3. Here is the example of the data below.
clsh1 clsh2 clsh3 clsh4 clsh5 clsh6 clsh7 clsh8 clsh9 clsh10
1. . . . . Yes . . . . .
2. . . . . Yes . . . . .
3. . . . . Yes . . Yes . .
4. . . . . Yes . . . . .
5. . . . . Yes . . Yes . .
6. . . . . Yes . . . . .
7. . . . . Yes . Yes . . .
8. . . . . Yes . . . . .
9. . . . . Yes . . Yes . .
10. . . . . Yes . . . . .
11. . . . . Yes . . . . .
12. . . . . Yes . . . . .
13. . . . . Yes . . . . .
14. . . . . Yes . . . . .
15. . . . . Yes . . . . .
16. . . . . Yes . . . . .
17. . . . . Yes . . . . .
18. . . . . Yes . . . . .
19. . . . . Yes . . . . .
20. . . . . Yes . . . . .
21. . . . . Yes . . . . .
22. . . . . Yes . . . . .
23. . . . . Yes . . . . .
24. . . . . Yes . . Yes . .
25. . . . . Yes . . . . .
26. . . . . Yes . . . . .
27. . . . . Yes . . . . .
28. . . . . Yes . . Yes . .
29. . . . . Yes . . Yes . .
30. . . . . Yes . . Yes . .
31. . . . . Yes . . Yes . .
32. . . . . Yes . . . . .
33. . . . . Yes . . . . .
34. . . . . Yes . . Yes . .
35. . . . . Yes . . . . .
36. . . . . Yes . . . . .
37. . . . . Yes . . . . .
38. . . . . Yes . . . . .
39. . . . . Yes . . Yes . .
40. . . . . Yes . . . . .
41. . . . . Yes . . . . .
42. . . . . . . . . . Yes
43. . . . . . . . . . Yes
44. . . . . . . . . . Yes
45. . . . . . . . . . Yes
46. . . . . . . . . . Yes
47. . . . . . . . . . Yes
48. . . . . . . . . . Yes
49. . . . . . . . . . Yes
50. . . . . . . . . . Yes
51. . . . . . . . . . Yes
52. . . . . . . . . . Yes
53. . . . . . . . . . Yes
54. . . . . . . . . . Yes
55. . . . . . . . . . Yes
56. . . . . . . . . . Yes
57. . . . . . . . . . Yes
58. . . . . . . . . . Yes
59. . . . . . . . . . Yes
60. . . . . . . . . . Yes
61. . . . . . . . . . Yes
62. . . . . . . . . . Yes
63. . . . . . . . . . Yes
64. . . . . . . . . . Yes
65. . . . . . . . . . Yes
66. . . . . . . . . . Yes
67. . . . . . . . . . Yes
68. . . . . . . . . . Yes
69. Yes . . . Yes . . Yes . .
70. . . . . . . . . . Yes
Related Posts with creating a categorical variable from multiple dummy variables
Tracking changes in dataset with conditionDear reader, I tracked executives across firms and retained those individual executives who were em…
Linear regression - error termDear all, I am trying to replicate the following variable as control for my dataset: Array After r…
Significance stars at 1%, 5% and 10%Hello, The STATA command "estimates table" produces output for all IVs with significance indicators …
How draw a number from a given vector of distribution?Hello everyone, and happy new year! I searched everywhere for an answer but could not find any, so …
Loop Panel Regression to save one coefficient and visualizeDear all, I am new to Stata and could use some help. I have a Panel-Data set where I try to analyze …
Subscribe to:
Post Comments (Atom)
0 Response to creating a categorical variable from multiple dummy variables
Post a Comment