Hi statausers:
I'm trying to run a Bootstrap code to get standard errors out of a matrix. The code runs well but when generating the matrix, all the entrances get used by the last data introduced. To avoid this, I tried generating different databases to get the statistics from. The code (simplified) looks like this:
global k = "2009/2011"
global l = "1/20"
forvalues i = $l {
forvalues i = $k {
use "$final_bootstrap\panel_2007-2011_stats.dta"
keep if year == 2008 | year ==`i'
save "$final_teffects\base_2008-`i'_stats_$l.dta"
clear
}
}
The idea was to generate 60 databases, 20 for each year (2009, 2010, 2011). However, Stata says the resulting file could not be opened and therefore it doesn't save the different databases, with the different names assigned.
Any help? Thanks in advance,
Adrian
Related Posts with How to create databases by loops
Individual Cross sectional regressions by firm and obtaining residuals... Please help me...Hello Everyone! I am totally new to STATA, and I have a brief question about running individual cros…
How to run individual cross sectional regression and obtaining residuals?..Hello Everyone! I am totally new to STATA, and I have a brief question about running individual cros…
Extending dataset based on certain dateDear Stata Users, Please help me with the following issue. I need to extend the following data set …
Very strange Macbook pro behavior - Stata won't close, caught in endless save loopVery strange Macbook pro behavior - Stata won't close, caught in endless save loop https://drive.g…
foreach issuesHi everyone! I have some issues in running two loops. What I want to do is to estimate alpha and bet…
Subscribe to:
Post Comments (Atom)
0 Response to How to create databases by loops
Post a Comment