Hi all, I have some data from a survey that I've tried to recreate below. The pattern is generally that Waves 1 and 2 consisted of multiple surveys over the course of a week or so, and then Wave 3 and 4 were just single surveys.
At Wave 3, some respondents were given some type of "treatment". We have a measure of different things (such as happiness, self-rated) across all waves. What I'm trying to do is get Stata to make some type of line or scatterplot where the mean happiness score is represented for the whole sample at Wave 1 and Wave 2, but is then allowed to diverge by "Treatment" starting at Wave 3 (and continuing at Wave 4).
Something along the lines of what you would see from a difference-in-differences or event study type of plot. I am agnostic about whether there is just one line at Waves 1 and 2 (and then it branches into 2) or 2 lines throughout. I do not use Stata much in my work, so I am not too familiar with creating figures and have not found a solution for this situation in the help files.
At Wave 3, some respondents were given some type of "treatment". We have a measure of different things (such as happiness, self-rated) across all waves. What I'm trying to do is get Stata to make some type of line or scatterplot where the mean happiness score is represented for the whole sample at Wave 1 and Wave 2, but is then allowed to diverge by "Treatment" starting at Wave 3 (and continuing at Wave 4).
Something along the lines of what you would see from a difference-in-differences or event study type of plot. I am agnostic about whether there is just one line at Waves 1 and 2 (and then it branches into 2) or 2 lines throughout. I do not use Stata much in my work, so I am not too familiar with creating figures and have not found a solution for this situation in the help files.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input byte(id wave survey_date happy treatment) 1 1 1 3 . 1 1 2 4 . 1 1 3 3 . 1 2 1 2 . 1 2 2 4 . 1 2 3 5 . 1 3 1 4 1 1 4 1 1 . 2 1 1 6 . 2 1 2 4 . 2 1 3 3 . 2 2 1 2 . 2 2 2 3 . 2 2 3 3 . 2 3 1 2 0 2 4 1 2 . 3 1 1 5 . 3 1 2 4 . 3 1 3 5 . 3 2 1 6 . 3 2 2 6 . 3 2 3 5 . 3 3 1 4 1 3 4 1 5 . 4 1 1 6 . 4 1 2 5 . 4 1 3 6 . 4 2 1 5 . 4 2 2 6 . 4 2 3 4 . 4 3 1 3 1 4 4 1 1 . 5 1 1 2 . 5 1 2 1 . 5 1 3 1 . 5 2 1 1 . 5 2 2 2 . 5 2 3 5 . 5 3 1 5 0 5 4 1 5 . 6 1 1 2 . 6 1 2 2 . 6 1 3 3 . 6 2 1 2 . 6 2 2 1 . 6 2 3 2 . 6 3 1 6 0 6 4 1 7 . end