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: defining program that is involved with stata and mata interaction
From
Zhi Su <[email protected]>
To
statalist <[email protected]>
Subject
st: defining program that is involved with stata and mata interaction
Date
Thu, 7 Jul 2011 22:00:32 -0400
Dear Statalists,
I write some commands
local basic "…"
gsort -TR
mvprobit (T1=`basic') (T2=`basic') (T3=`basic') (T4=`basic') if TR==1,robust
scalar O=e(N)
mvppred xbm if TR==1,xb
mata
N=3000
O=st_numscalar("O")
.
.
Y=st_data(k,("T1","T2","T3","T4"))
XBM=st_data(k,("xbm1", "xbm2", "xbm3","xbm4"))
.
.
st_store(k,("u1", "u2","u3","u4"),M_c)
end
forvalue k=1/4{
replace u`k'=0 if u`k'==. &TR==0
}
regress e1 `basic’ `T’ `u’, robust
The program process run well when I run them directly.
Then I want to bootstrapp the whole process. Therefore, I
capture program drop NHreg
program define NHreg
local basic "…"
gsort -TR
mvprobit (T1=`basic') (T2=`basic') (T3=`basic') (T4=`basic') if TR==1,robust
scalar O=e(N)
mvppred xbm if TR==1,xb
mata
N=3000
O=st_numscalar("O")
.
.
Y=st_data(k,("T1","T2","T3","T4"))
XBM=st_data(k,("xbm1", "xbm2", "xbm3","xbm4"))
.
.
st_store(k,("u1", "u2","u3","u4"),M_c)
end
forvalue k=1/4{
replace u`k'=0 if u`k'==. &TR==0
}
regress e1 `basic’ `T’ `u’, robust
end
I think the defined command "NHreg" will process all the whole progam.
Then I run command
NHreg
But the process can not go through at all.
Why the commands can not work through when I put them in “program
define NHreg” and use command "NHreg" to run them?
Thank you!
--
Zhi Su
348 Holmes Hall
Northeastern University
360 Huntington Avenue
Boston, MA 02115
Office:1-617-373-2316
email:[email protected]
*
* 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/