Hi everyone,
I was wondering to know how can I combine the below stacked variables into a single variable. Nick's solution here is great but I wonder how it can be extended to include a large number of variables.
Thanks,
NM

Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input str6(ei_x20 ei_x19 ei_x18 ei_x17 ei_x16 ei_x15 ei_x14 ei_x13 ei_x12 ei_x11 ei_x10) str5(ei_x9 ei_x8 ei_x7 ei_x6 ei_x5 ei_x4 ei_x3 ei_x2 ei_x1)
"ei_x20" ""       ""       ""       ""       ""       ""       ""       ""       ""       ""       ""      ""      ""      ""      ""      ""      ""      ""      ""     
""       "ei_x19" ""       ""       ""       ""       ""       ""       ""       ""       ""       ""      ""      ""      ""      ""      ""      ""      ""      ""     
""       ""       "ei_x18" ""       ""       ""       ""       ""       ""       ""       ""       ""      ""      ""      ""      ""      ""      ""      ""      ""     
""       ""       ""       "ei_x17" ""       ""       ""       ""       ""       ""       ""       ""      ""      ""      ""      ""      ""      ""      ""      ""     
""       ""       ""       ""       "ei_x16" ""       ""       ""       ""       ""       ""       ""      ""      ""      ""      ""      ""      ""      ""      ""     
""       ""       ""       ""       ""       "ei_x15" ""       ""       ""       ""       ""       ""      ""      ""      ""      ""      ""      ""      ""      ""     
""       ""       ""       ""       ""       ""       "ei_x14" ""       ""       ""       ""       ""      ""      ""      ""      ""      ""      ""      ""      ""     
""       ""       ""       ""       ""       ""       ""       "ei_x13" ""       ""       ""       ""      ""      ""      ""      ""      ""      ""      ""      ""     
""       ""       ""       ""       ""       ""       ""       ""       "ei_x12" ""       ""       ""      ""      ""      ""      ""      ""      ""      ""      ""     
""       ""       ""       ""       ""       ""       ""       ""       ""       "ei_x11" ""       ""      ""      ""      ""      ""      ""      ""      ""      ""     
""       ""       ""       ""       ""       ""       ""       ""       ""       ""       "ei_x10" ""      ""      ""      ""      ""      ""      ""      ""      ""     
""       ""       ""       ""       ""       ""       ""       ""       ""       ""       ""       "ei_x9" ""      ""      ""      ""      ""      ""      ""      ""     
""       ""       ""       ""       ""       ""       ""       ""       ""       ""       ""       ""      "ei_x8" ""      ""      ""      ""      ""      ""      ""     
""       ""       ""       ""       ""       ""       ""       ""       ""       ""       ""       ""      ""      "ei_x7" ""      ""      ""      ""      ""      ""     
""       ""       ""       ""       ""       ""       ""       ""       ""       ""       ""       ""      ""      ""      "ei_x6" ""      ""      ""      ""      ""     
""       ""       ""       ""       ""       ""       ""       ""       ""       ""       ""       ""      ""      ""      ""      "ei_x5" ""      ""      ""      ""     
""       ""       ""       ""       ""       ""       ""       ""       ""       ""       ""       ""      ""      ""      ""      ""      "ei_x4" ""      ""      ""     
""       ""       ""       ""       ""       ""       ""       ""       ""       ""       ""       ""      ""      ""      ""      ""      ""      "ei_x3" ""      ""     
""       ""       ""       ""       ""       ""       ""       ""       ""       ""       ""       ""      ""      ""      ""      ""      ""      ""      "ei_x2" ""     
""       ""       ""       ""       ""       ""       ""       ""       ""       ""       ""       ""      ""      ""      ""      ""      ""      ""      ""      "ei_x1"
end