Hello everyone

I would like to request some expert help about how to turn a classic wide format dataset into daydic dataset.

This is the wide format (pt=patient; cg=caregiver)
id score_pt gender_pt age_pt gender_cg age_cg score_cg
1 53.57 1 76 2 44 71.42
2 50 2 85 2 26 53.57
3 42.85 2 89 2 64 39.28
And this is the ideal dyadic dataset (id 1=patient; id 2=caregiver)
dyad id score gender age
1 1 53.57 1 76
1 2 71.42 2 44
2 1 50 2 85
2 2 53.57 2 26
3 1 42.85 2 89
3 2 39.28 2 64
Does anyone know the syntax to convert wide into dyadic?
Thanks in advance for the help

Paolo