Hello,
I have a cross-sectional dataset (Demographic and Health Surveys) contains information regarding the households and their members. However, the dataset is structured based on the household and the household head. Therefore, the responses of the other members are coded repeatedly side by side (in the same line for each household). For instance;

Code:
clear

input str8 caseid byte (v001 v002 v003) long v004 byte (_v1 _v2 _v3 _v4 _v5 _v6 se025 s36)

caseid v001 v002 v003 v004 _v1 _v2 _v3 _v4 _v5 _v6 se025 s36
112 1 1 2 123652 1 1 0 . . . 3 2
212 2 1 2 123236 1 1 0 2 2 0 3 1

end

label variable caseid "caseid"

label variable v001 "Cluster Number"

label variable v002 "Household Number"

label variable v003 "Respondent's Line Number"

label variable v004 "Sample Weight"

label variable _v1 "Birth column number"

label variable _v2 "Birth order number"

label variable _v3 "Child is twin"

label variable _v4 "Birth column number"

label variable _v5 "Birth order number"

label variable _v6 "Child is twin"

label variable se025 "Type of toilet"

label variable s36 "Water source"
Nevertheless, I want to restructure dataset as follows;

Code:
clear

input str8 caseid byte (v001 v002 v003) long v004 byte (_v1 _v2 _v3 se025 s36)

caseid v001 v002 v003 v004 _v1 _v2 _v3 se025 s36
112 1 1 2 123652 1 1 0 3 2
212 2 1 2 123236 1 1 0 3 1
212 2 1 2 123236 2 2 0 3 1

end
 
label variable caseid "caseid"

label variable v001 "Cluster Number"

label variable v002 "Household Number"

label variable v003 "Respondent's Line Number"

label variable v004 "Sample Weight"

label variable _v1 "Birth column number"

label variable _v2 "Birth order number"

label variable _v3 "Child is twin"

label variable se025 "Type of toilet"

label variable s36 "Water source"
I read several posts related to reshape command; however, I could not figure out how I could adapt the suggested solutions to my problem. Thank you in advance for your suggestions.

Ömer.