I want to use Mata to create a block diagonal matrix. There is an example in the documentation for three matrices:
blockdiag(Z1, blockdiag(Z2,Z3))
It's not clear to me if that can be extended to more matrices:
blockdiag(Z1, blockdiag(Z2, blockdiag(Z3,Z4)))
blockdiag(Z1, blockdiag(z2, blockdiag(Z3, blockdiag(Z4,Z5))))
or if some looping structure could be written to more efficiently complete the matrix. Suggestions/insight appreciated.