I would likely tackle this problem by reading in the raw dataset with
just one string variable per line of data. Then I would create some
variables from the lines that begin with "1", the simpler case. Then
I'd create more variables from the lines beginning with "2". This is a
bit more complicated, and I would probably make use of the index
function.
That done, I would fill down data for consecutive observations that
are really one record, and keep one observation per record.
Sorry I don't have the time to write actual code.
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/