My data looks as follows:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str90 title str6 region str20(country1 country2) "Total population" "Europe" "717438" "674920" "Male" "Europe" "345865" "325647" "Female" "Europe" "371573" "349273" "Under 5 years" "Europe" "43090" "41267" "5 to 9 years" "Europe" "43281" "44109" "10 to 14 years" "Europe" "46701" "41423" "15 to 19 years" "Europe" "46000" "42859" "20 to 24 years" "Europe" "40348" "43193" "25 to 34 years" "Europe" "92674" "91857" "35 to 44 years" "Europe" "88657" "82199" "45 to 54 years" "Europe" "87619" "81556" "55 to 59 years" "Europe" "48179" "42805" "60 to 64 years" "Europe" "49738" "43319" "65 to 74 years" "Europe" "78932" "70407" "75 to 84 years" "Europe" "39375" "37904" "85 years and over" "Europe" "12844" "12022" "Median age (years)" "Europe" "40.4" "39.0" "18 years and over" "Europe" "556011" "523012" "65 years and over" "Europe" "131151" "120333" "Total population" "Europe" "717438" "674920" "One race" "Europe" "702458" "661882" "White" "Europe" "479955" "424115" end
gen dummy=1
encode title, gen(title_num)
reshape wide country1 country2, i(dummy) j(title_num)
encode title, gen(title_num)
reshape wide country1 country2, i(dummy) j(title_num)
Thank you very much in advance!!
0 Response to Reshape with two columns to rows
Post a Comment