I have many symmetric and square datasets in separate Stata files. The dimensions of these datasets are not the same. I wish to append them diagonally.
The off diagonals will be zero, but I cannot find a way to append. Is there a way to do that?
Let me explain with an example:
The first dataset is like this:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input byte id double(year n2 n3 n4 n5 n6) 2 2000 0 18.744158257958475 18.744158257958475 0 0 3 2000 18.744158257958475 0 0 0 0 4 2000 18.744158257958475 0 0 46.37805700632478 0 5 2000 0 0 46.37805700632478 0 46.37805700632478 6 2000 0 0 0 46.37805700632478 0 end
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input byte id double(year n2 n3 n4 n5 n6 n9 n12 n13) 13 2001 0 0 0 0 0 0 7.276305348137391 0 18 2001 0 0 0 0 0 0 18.666791362792665 0 20 2001 6.00363641683089 8.56616959440156 0 0 0 27.012442141765952 0 0 22 2001 0 0 0 0 0 0 24.815313813108695 0 23 2001 0 0 0 0 0 0 4.431133169071336 0 24 2001 0 0 0 0 0 0 0 0 25 2001 0 0 0 0 0 0 0 0 26 2001 0 0 0 0 0 0 0 0 end
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input double(id year) float(E1 E2 E3 E4 E5 E6 E7 E8 E9 E10 E11 E12 E13) 2 2000 0 18.744158 18.744158 0 0 0 0 0 . 0 0 0 0 3 2000 18.744158 0 0 0 0 0 0 0 . 0 0 0 0 4 2000 18.744158 0 0 46.37806 0 0 0 0 . 0 0 0 0 5 2000 0 0 46.37806 0 46.37806 0 0 0 . 0 0 0 0 6 2000 0 0 0 46.37806 0 0 0 0 . 0 0 0 0 13 2001 0 0 0 0 . 0 0 6.003636 0 0 0 7.276305 0 18 2001 0 0 0 0 . 0 0 8.56617 0 0 0 18.666792 0 20 2001 0 0 0 0 . 6.003636 8.56617 0 0 0 27.01244 0 0 22 2001 0 0 0 0 . 0 0 0 0 0 0 24.815313 0 23 2001 0 0 0 0 . 0 0 0 0 0 0 4.4311333 0 24 2001 0 0 0 0 . 0 0 27.01244 0 0 0 0 0 25 2001 0 0 0 0 . 7.276305 18.666792 0 24.815313 4.4311333 0 0 0 26 2001 0 0 0 0 . 0 0 0 0 0 0 0 0 end
Thank you in advance for your suggestions. They are very valuable for me.
Best,
0 Response to Appending symmetric files diagonally
Post a Comment