Skip to main content

Timeline for Reshaping/transposing data in Stata

Current License: CC BY-SA 4.0

12 events
when toggle format what by license comment
Jul 5 at 15:28 comment added Nick Cox I've been a member of Statalist since 1994 and never seen a random question. Perhaps introduced later.
Jul 5 at 15:15 vote accept Emma
Jul 5 at 15:38
Jul 5 at 15:04 history edited Nick Cox CC BY-SA 4.0
added 1388 characters in body
Jul 5 at 15:04 comment added Nick Cox I don't follow that. If you can talk to SO, you can talk to Statalist. But any way, please see my edit.
Jul 5 at 15:01 comment added Emma I'm unfortunately unable to register for statalist as my version of stata is based on a server without internet access, and so cannot get the authkey to register or contact them!
Jul 5 at 14:46 comment added Emma Sure I've edited my question to reflect this. But I think you might be right, I have also been thinking I may need to look into a different data layout!
Jul 5 at 14:44 comment added Nick Cox That said, I fear that you're asking for a data layout that won't work for your data. I would post a version of this on Statalist where you're much more likely to get attention from medical statisticians.
Jul 5 at 14:32 comment added Nick Cox You need to revise your question so that you show a dataset that is complicated enough to show the problem and compact enough to show here.
Jul 5 at 14:00 comment added Emma Hi Nick, Thanks so much for your speedy help. I do still have a problem however, which I think is due to having duplicated IDs in the controlb1-b4 columns, and differing indexdates for these. (Some controls were matched to multiple cases, and the indexdate is decided based on the case.) Is there any way around this? Thanks. Error: variable id does not uniquely identify the observations Your data are currently wide. You are performing a reshape long. You specified i (index_date) and j(which). In the current wide form, variable index_date should uniquely identify the observations.
Jun 11 at 6:27 history edited Nick Cox CC BY-SA 4.0
added 342 characters in body
Jun 10 at 20:54 history edited Nick Cox CC BY-SA 4.0
edited body
Jun 10 at 19:44 history answered Nick Cox CC BY-SA 4.0