Dear Statalist members,
I could really need your help with a problem that drives me mad for a while. I am certain that this is an easy problem but I can't seem to find anything on the forum. Personally I consider this a rather complex issue and hope that someone could help me find a solution for my problem. Or a link where I myself can find the answer.
Anyway! Bellow I provide you a data example taken from my actual dataset. If it matters for the solution, I'm using Stata 14.
What I'm trying to achieve is the following:
Many thanks in advance,
Jonas
I could really need your help with a problem that drives me mad for a while. I am certain that this is an easy problem but I can't seem to find anything on the forum. Personally I consider this a rather complex issue and hope that someone could help me find a solution for my problem. Or a link where I myself can find the answer.
Anyway! Bellow I provide you a data example taken from my actual dataset. If it matters for the solution, I'm using Stata 14.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long id byte(wave q1 q2 q3 q4 q5 q6) 4010908 1 .m .m .m .m .m .m 4010908 2 .m .m .m .m .m .m 4010908 3 5 1 1 1 5 4 4010908 4 . . . . . . 4010908 5 .m .m .m .m .m .m 4010908 6 . . . . . . 4010908 7 5 1 1 1 5 5 4010908 8 4 2 1 1 3 4 4010908 9 . . . . . . 4010909 1 .m .m .m .m .m .m 4010909 2 .m .m .m .m .m .m 4010909 3 . . . . . . 4010909 4 . . . . . . 4010909 5 . . . . . . 4010909 6 . . . . . . 4010909 7 . . . . . . 4010909 8 . . . . . . 4010909 9 . . . . . . 4010910 1 .m .m .m .m .m .m 4010910 2 .m .m .m .m .m .m 4010910 3 3 3 1 1 4 3 4010910 4 . . . . . . 4010910 5 .m .m .m .m .m .m 4010910 6 . . . . . . 4010910 7 4 3 2 2 4 3 4010910 8 5 3 2 2 4 4 4010910 9 . . . . . . end label values wave en2574 label def en2574 1 "Fall 2010", modify label def en2574 2 "Summer 2011", modify label def en2574 3 "2011/2012", modify label def en2574 4 "Spring 2012", modify label def en2574 5 "2012/2013", modify label def en2574 6 "Spring 2013", modify label def en2574 7 "2013/2014", modify label def en2574 8 "2014/2015", modify label def en2574 9 "2015/2016", modify label values q1 en511 label values q2 en511 label values q3 en511 label values q4 en511 label values q5 en511 label values q6 en511 label def en511 3 "half and half", modify label def en511 4 "rather agree", modify label def en511 5 "completely agree", modify label def en511 .m "Missing by design", modify label def en511 1 "completely disagree", modify label def en511 2 "rather disagree", modify
- I'd like to create a variable x that counts in how many waves each individual has answered all six questions (q1-q6). For example, some individuals have answered the questions only in wave 3 but not in wave 7, 8 and 9. Others, however, might have answered the questions at all four time points. The variable x I'd like to create should tell me that person 1 has answered all 6 questions 3 times, meaning in 3 waves. The value for the second person would be 0 because he or she did not answer the six questions in any wave. For the third person the value of x should be 3 again because he, too, has given full responses in 3 waves.
- Furthermore, I'd like to know at which time point a person has given his or her responses. It makes a difference in my analysis if a person answered questions q1-q6 in wave 3 and 7 or in wave 8 and 9.
Many thanks in advance,
Jonas
Comment