In my dataset, there are multiple rows of HHID with the same HHID. Each row of HHID is associated with multiple observations of l_type and serial_number_l.
I want only one row of HHID while retaining specific values of l_type and serial_number_l. For instance, i want to keep per HHID, l_type ==1 and l_type==2 and l_type==10.
The reason i want to keep only one HHID per row is because i need to merge this data with other HH level datasets.
I tried reshaping to wide-format but the dataset became very messy with lot of missing values. I also tried egen but then it created variables at the different rows of the HHID. So, I could not make one HHID per row with the egen variables.
Kindly suggest a way to make the process easy for merging.
HHID Serial_number_plot l_type L_ar L_va W_l W_o
533352011 1 2 0.80 700000 2
533352011 98 10 0.04 85000 2
533352011 99 0.84 785000
533353011 1 2 0.60 40000 2
533353011 2 2 0.22 150000 2
533353011 98 10 0.06 85000 2
533353011 99 0.88 275000
533353021 1 2 0.80 650000 2
533353021 98 10 0.07 65000 2
533353021 99 0.87 715000
533353031 1 2 0.80 770000 2
533353031 98 10 0.06 120000 2
533353031 99 0.86 890000
I want only one row of HHID while retaining specific values of l_type and serial_number_l. For instance, i want to keep per HHID, l_type ==1 and l_type==2 and l_type==10.
The reason i want to keep only one HHID per row is because i need to merge this data with other HH level datasets.
I tried reshaping to wide-format but the dataset became very messy with lot of missing values. I also tried egen but then it created variables at the different rows of the HHID. So, I could not make one HHID per row with the egen variables.
Kindly suggest a way to make the process easy for merging.
HHID Serial_number_plot l_type L_ar L_va W_l W_o
533352011 1 2 0.80 700000 2
533352011 98 10 0.04 85000 2
533352011 99 0.84 785000
533353011 1 2 0.60 40000 2
533353011 2 2 0.22 150000 2
533353011 98 10 0.06 85000 2
533353011 99 0.88 275000
533353021 1 2 0.80 650000 2
533353021 98 10 0.07 65000 2
533353021 99 0.87 715000
533353031 1 2 0.80 770000 2
533353031 98 10 0.06 120000 2
533353031 99 0.86 890000
Comment