# Revision history [back]

Here is an example of doing this with some fake generated data.

* Disable detailed output information
set nodoecho
set noecho

* Dimension the output vectors to store the intercepts and coefficients
dim myinter 10
dim mycoeff 10

* Set our sample to 12 observations
sample 1 12

* Do 10 fake regressions and copy the results to a single vector
*   N.B. Prefixing commands by ? hides their output
do(% = 1, 10)

* Generate 10 fake data sets for variables y and x
?genr y% = % + nor(1)
?genr x% = %-1 + 10 * nor(5)

* Perform a simple regression of y on x and a constant
?ols y% x% / coeff=coeff%
print coeff%

* Copy the generated coefficient to the place in the vector we wish /
copy coeff% myinter / frow=1;1 trow=%;%
copy coeff% mycoeff / frow=2;2 trow=%;%

endo

* Print the vectors
print myinter mycoeff

 2 Added a description of what is being done. SHAZAMHelp 417 ●12 ●16 ●27 http://econometrics.com/

This can be done simply by DIMensioning the two vectors, saving the coefficient vector on each OLS and then using the COPY command to copy the coefficients to the locations in the vectors you desire.

Here is an example of doing this with some fake generated data.

* Disable detailed output information
set nodoecho
set noecho

* Dimension the output vectors to store the intercepts and coefficients
dim myinter 10
dim mycoeff 10

* Set our sample to 12 observations
sample 1 12

* Do 10 fake regressions and copy the results to a single vector
*   N.B. Prefixing commands by ? hides their output
do(% = 1, 10)

* Generate 10 fake data sets for variables y and x
?genr y% = % + nor(1)
?genr x% = %-1 + 10 * nor(5)

* Perform a simple regression of y on x and a constant
constant
?ols y% x% / coeff=coeff%
print coeff%

* Copy the generated coefficient to the place in the vector we wish /
wish/
copy coeff% myinter / frow=1;1 trow=%;%
copy coeff% mycoeff / frow=2;2 trow=%;%

endo

* Print the vectors
print myinter mycoeff

 3 Added comment SHAZAMHelp 417 ●12 ●16 ●27 http://econometrics.com/

This can be done simply by DIMensioning the two vectors, saving the coefficient vector on each OLS and then using the COPY command to copy the coefficients to the locations in the vectors you desire.

Here is an example of doing this with some fake generated data.

* Disable detailed output information
set nodoecho
set noecho

* Dimension the output vectors to store the intercepts and coefficients
dim myinter 10
dim mycoeff 10

* Set our sample to 12 observations
sample 1 12

* Do 10 fake regressions and copy the results to a single vector
*   N.B. Prefixing commands by ? hides their output
do(% = 1, 10)

* Generate 10 fake data sets for variables y and x
?genr y% = % + nor(1)
?genr x% = %-1 + 10 * nor(5)

* Perform a simple regression of y on x and a constant
constant and save the coefficients
?ols y% x% / coeff=coeff%
print coeff%

* Copy the generated coefficient to the place in the vector we wish/
wish
copy coeff% myinter / frow=1;1 trow=%;%
copy coeff% mycoeff / frow=2;2 trow=%;%

endo

* Print the vectors
print myinter mycoeff

 4 No.4 Revision SHAZAMHelp 417 ●12 ●16 ●27 http://econometrics.com/

This can be done simply by DIMensioning the two vectors, saving the coefficient vector on each OLS and then using the COPY command to copy the coefficients to the locations in the vectors you desire.

Here is an example of doing this with some fake generated data.

* Disable detailed output information
set nodoecho
set noecho

* Dimension the output vectors to store the intercepts and coefficients
dim myinter 10
dim mycoeff 10

* Set our sample to 12 observations
sample 1 12

* Do 10 fake regressions and copy the results to a single vector
*   N.B. Prefixing commands by ? hides their output
do(% = 1, 10)

* Generate 10 fake data sets for variables y and x
?genr y% = % + nor(1)
?genr x% = %-1 + 10 * nor(5)

* Perform a simple regression of y on x and a constant and - save the coefficients
?ols y% x% / coeff=coeff%
print coeff%

* Copy the generated coefficient to the place in the vector we wish
copy coeff% myinter / frow=1;1 trow=%;%
copy coeff% mycoeff / frow=2;2 trow=%;%

endo

* Print the vectors
print myinter mycoeff