Sabre |
Data preparation in Stata: Reshaping data | |
Sabre manual |
Dunn (1992) reported data for the 12-item version of Goldberg's (1972) General Health Questionnaire for psychological distress. The questionnaire was completed by 12 students on 2 dates, 3 days apart. The data are repeated in the table below, the same data were used by Rabe-Hesketh and Skrondal (2005, exercise 1.2). Data description Number of observations (rows): 12 Variables student: student identifier {1,2,...,12}
Stata dataset ghq.dta The ghq.dta dataset contains variables ghq1 and ghq2 giving the psychological distress score for students on two separate occasions. To reshape the data from wide into long format and create a single score variable ghq, we can use reshape long ghq, i(student) j(r) This also creates a response indicator variable r, the associated dummy variables dg1 and dg2 and saves the file ghq2.dta. Variables r: response occasion 1, 2 The data set was saved as ghq2.dta
ghq2.dta This data set can now be read directly into Sabre, see for example Exercise L1. |
Other links: Centre for e-Science | Centre for Applied Statistics