I have seen discussions on looping across an unknown number of columns which can be solved by -reshape-
My question is how to sum across columns where the number of columns varies from one observation to the next. i.e. I may need to sum columns 2 to 5 for the first observation but from columns 4 to 11 for the second observation. In all cases the summation is done across a set of adjacent columns.
I have tried to use -rowcount-, and the looping functions but as far as I can tell all sum across a fixed number of columns from one observation to the next. But there is something good also; the information on the column to begin and the column to end the summation for each observation is contained in two adjacent column which are the same for all the observations.
Feedback is highly appreciated upfront.
Edward.
This message has been scanned for viruses by TRENDMICRO,
an IESE technology affiliate company and global leader in antivirus and content security software.
*
* 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/