Hello everyone,

Just trying to puzzle out how to reshape my dataset from wide format to long, but with multiple variables. To explain, I have data on patients and whether the patients are experiencing violence or not, and information on their household members (among other variables obviously, but these are the ones that need re-shaping). All this information on multiple household members is attached to one patient ID in wide format. Additionally, because the violence questions had multiple option selection possibilities, they have been saved as separate variables in the dataset. Here's an example (hhmage1 is the age for the first household member, hhgen1 is the gender of the first household member, hhmage 2 is the age of the second household member, etc. IPV_restrict1-4 is one question on IPV that had four possible responses, and has been saved as 4 separate variables with a 0 if they didn't tick the response, and a 1 if they did tick the response):


CODE:
list Participant_ID hhmage0 hhmgen0 IPV___restrict_1 IPV___restrict_2 IPV___restrict_3 IPV___restrict_4 in 1/5

OUTPUT (Wide format):
Partic~D hhmage1 hhmgen1 hhmage2 hhmgen2 IPV~ct_1 IPV_~ct_2 IPV_~ct_3 IPV_~ct_4

1. xxxxxxxx 63 Female 29 Female 0 1 1 1
2. xxxxxxxx 30 Male 64 Female 1 1 0 1
3. xxxxxxxx 50 Female 31 Male 0 1 1 1
4. xxxxxxxx 37 Male 63 Female 0 1 0 1
5. xxxxxxxx 64 Female 43 Female 0 1 1 0


I would like to get the dataset into long format so that I can run more detailed analysis on the household using the information on the household members (I also have information on their employment and socio-economic status), and later on, in seperate analyses, I want to look at IPV experienced by each patient. However, how do I reshape the data from wide to long for multiple j variables as I can only do so for one new j variable at a time - e.g. householdmembernumber, or IPV, but not both at once. Do I need to split my dataset up and then re-attach? Or is there a better way?

Thanks in advance.