Hi there, I am fairly new to Stata.
I am needing help in reshaping a database from long to wide. I have 3 variables
pid(unique identifier),
Diagnosis and
DiagnosisDate, as illustrastred below.
| pid |
Diagnosis |
DiagnosisDate |
| 1 |
HSV2 |
06-02-20 |
| 1 |
HSV2 |
06-02-19 |
| 2 |
TV |
01-01-20 |
| 2 |
BV |
01-01-20 |
| 3 |
Syphillis |
06-05-19 |
I tried using the command
reshape wide Diagnosis, i(pid) j(DiagnosisDate), and i get an error message values of variable DiagnosisDate not unique within pid. I would really appreciate guidance on how i proceed to create one observation per pid instead of the existing multiple ones.
Many thanks
Ardele
0 Response to Reshaping dta from long to wide format
Post a Comment