I have questions about esttab/estout (Stata 17) that I could not fix myself, and I need advice from the community.
Firstly, I have several variables that I would like to put into my regression. These variables measure different aspects but have the same concept. So, I defined the global variable and made a loop for my regression. Here is my code (the actual name of variables have been changed due to confidentiality)
I did the code like this because I want to show all four conditions on the same line, which (hopefully) makes it easier to compare across four conditions. Of course, this is not the only specification that I did. There were other specifications, and I used the same `esttab` command to generate the table.
My questions are the following;
Firstly, I have several variables that I would like to put into my regression. These variables measure different aspects but have the same concept. So, I defined the global variable and made a loop for my regression. Here is my code (the actual name of variables have been changed due to confidentiality)
Code:
global cons con_a con_b con_c con_d
eststo clear
foreach var of global cons {
preserve
rename (`var') (conduct)
reg y conduct x c.x#c.conduct, r
eststo `var'
restore
}
esttab con_* using "${main_tex}/sample.tex", replace ///
label booktabs nobaselevels interaction(" $\times$ ") b(4) ar2 nonumbers ///
mtitles ("con_a" "con_b" "con_c" "con_d") ///
title(This is a sample\label{tab1})
My questions are the following;
- At first, I used
rather thanCode:
esttab _all
. However, Stata exported more than four models in the report. It is definitely incorrect since the loop I wrote had only four variables. I checkedCode:esttab con_
, and found that Stata stored more than four models in the memory. I ranCode:return list
, but it did not remove the model from the Stata's memory as `esttab _all` it still shows the same result (report more than four models). Did I use the right command to clear the memory in `eststo`?Code:eststo clear
- How can I check the models saved in the `eststo`?
- Since I changed the variable name to the conduct I had a problem when I reported the interaction term. To be exact, the interaction term (c.x and i.category = 1) is still in the table, and I cannot use label it to resolve this problem since I did not have this variable in the database. Note again that the conduct is generated only to align four conditions to be on the same line. I checked `esttab` the documentation, and it seems like label it is the only way the developers suggested. Is there another way to tackle this problem?

Comment