if prad_coeff is variable, use:
replace prad_coeff = C1`i'[1,1] in `i'
dp similar changes for others.
-----Original Message-----
From: Radu Ban [mailto:[email protected]]
Sent: Friday, November 08, 2002 3:24 PM
To: [email protected]
Subject: st: replace variable, observation by observation
Dear all,
I have the following loop (this is only a part of a do file)
.....
for any prad_coeff prad_error prad_tval constant_coeff constant_error
constant_tval nrobs nonzeroobs regnum: gen X = 999;
local i = 1;
foreach var of varlist `outcomes' {;
reg `var' prad;
mat C1`i' = e(b);
mat E1`i' = e(V);
replace prad_coeff[`i'] = C1`i'[1,1];
replace prad_error[`i'] = sqrt(E1`i'[1,1]);
replace constant_coeff[`i'] = C1`i'[1,2];
replace constant_error[`i'] = sqrt(E1`i'[2,2]);
replace nrobs[`i'] = e(N);
replace count if `var' ~= 0 & `var' ~= .;
replace nonzeroobs[`i'] = r(N);
replace regnum[`i'] = `i';
local i = `i' + 1;
};
....
when I run it, I get an error message (after the first regression, so I'm
assuming the error is in the loop):
weights not allowed
I'm not sure what this means, but I suspect that I cannot replace variables
observation by observation. Is there a way to work around this?
Thanks so much,
Radu Ban
*
* 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/
*
* 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/