Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Thread-Index: AczWnG9bfd8mYxtIRa2sdn3BOpo1xA==
From
"STANEVA A. (497186)" <[email protected]>
To
"[email protected]" <[email protected]>
Subject
st: Thread-Index: AczWnG9bfd8mYxtIRa2sdn3BOpo1xA==
Date
Thu, 19 Jan 2012 11:21:25 +0000
Dear Stata List Users,
Can someone help me with this loop in a qreg?
This first line works ok!
forval i = 1/99 {
local q = `i'/100
quietly qreg $y $x if public==0, quantile(`q') nolog
matrix b = e(b)
matrix b[1, colnumb(b,"_cons")] = scalar(u99) /*I get the constant and replace it with the scalar u99, that I want/
}
The problem comes here. I want the replaced u99 to be included in my qreg and then to get the predictions based on that regression:
forval i = 1/99 {
local q = `i'/100
local `b’= scalar (u99)
quietly qreg $y $x if public==0, quantile (`q') nolog
predict xb if public==0
preserve
keep if xb~=.
restore
}
However, there is a problem in the line local`b'=scalar(u99), it seems stata doesn’t replace the _cons with the u99. It runs normal qreg, ignoring all this manipulations.
I will appreciate your help!
Best wishes
Anita
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/