Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: replace variable, observation by observation


From   "Jiang, Tao" <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: RE: replace variable, observation by observation
Date   Fri, 8 Nov 2002 15:19:56 -0500

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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index