first, you can write them in a matrix;
then transform the matrix into a variable.
for example:
*-> Generate dataset
clear
set obs 100
set seed 13579
gen e = invnorm(uniform())
forvalues i = 1(1)10{
gen x_`i' = `i' + `i'*invnorm(uniform())
}
gen y = x_1 + x_2 + e
*-> Regression and record the results
mat aa = J(10,3,0)
forvalues i=1(1)10{
reg y x_`i'
mat aa[`i',1] = (_b[_cons],_b[x_`i'],e(r2))
}
*-> Presenting results
mat colnames aa = _cons x R2
mat list aa
svmat aa, names(r)
list r* in 1/10
* Given by Arlion, arlionn@163.com
* === the results=====
. mat list aa
aa[10,3]
_cons x R2
r1 2.197865 .81739822 .11566624
r2 1.0777354 .9542421 .69421448
r3 2.7370277 .09824314 .01268297
r4 2.705197 .06487209 .01096211
r5 2.66488 .0597639 .0165342
r6 2.652783 .05263239 .01797095
r7 3.3185105 -.04159638 .01028677
r8 2.7299905 .03841558 .01417722
r9 3.1960058 -.0214982 .00514277
r10 3.1034818 -.01074885 .00200037
. svmat aa, names(r)
. list r* in 1/10
+---------------------------------+
| r1 r2 r3 |
|---------------------------------|
1. | 2.197865 .8173982 .1156662 |
2. | 1.077735 .9542421 .6942145 |
3. | 2.737028 .0982431 .012683 |
4. | 2.705197 .0648721 .0109621 |
5. | 2.66488 .0597639 .0165342 |
|---------------------------------|
6. | 2.652783 .0526324 .017971 |
7. | 3.318511 -.0415964 .0102868 |
8. | 2.72999 .0384156 .0141772 |
9. | 3.196006 -.0214982 .0051428 |
10. | 3.103482 -.0107489 .0020004 |
+---------------------------------+