-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  C:\Users\fan\Stata4Econ\reglin\multipanel\allpurpose\allpurpose.smcl
  log type:  smcl
 opened on:   9 Apr 2020, 11:23:03


. log on (log already on)

. . set trace off

. set tracedepth 1

. . ///////////////////////////////////////////////// > ///--- A0. Load Data > ///////////////////////////////////////////////// > . set more off

. set trace off

. . sysuse auto, clear (1978 Automobile Data)

. . ///--- Controls > global quiornot "qui"

. * global quiornot "noi" . . ///////////////////////////////////////////////// > ///--- A1. Core String Initiation > ///////////////////////////////////////////////// > /* > A regression has: > 1. reg method: stc_rgc > 2. LHS: svr_lhs > 3. RHS (to keep): svr_rhs (go to svr_kep) > 4. RHS (controls not to show in table): svr_cov > 5. Conditions: svr_cdn > 6. reg options: stc_opt > */ . . * rgc = regression, opt = option . global stc_rgc "reg"

. global stc_opt ", robust"

. . * sca = what scalar statistics to obtain from reg . global stc_sca "r2 rank"

. . * cdn = conditioning . global sif_cdn "if price !=. & foreign !=."

. . * regression outcome . global svr_lhs "price"

. . * right and side and what to Display . * svr_rhs what we want to keep on table . * svr_cov controls to not show on table . * this keeping aspect is not automatic, to allow flexibility, can specify . * with svr_kep what should be kept, below it is keeping svr_rhs. . global svr_rhs "rep78"

. global svr_cov "gear_ratio"

. . global svr_kep "${svr_rhs}"

. . ///////////////////////////////////////////////// > ///--- A2. Set Number of Rows and Columns > ///////////////////////////////////////////////// > . * column count, and panel count . * can specify any numbers here, code will run for any col and row count . * if both equal to 1, will only generate 1 panel with 1 column of regression . * if both very large, but do not specify column or panel specific variables or . * conditions, will just keep running identical regressions over and over. . global it_col_cnt = 7

. global it_pan_cnt = 6

. . ///////////////////////////////////////////////// > ///--- A3. Labeling > ///////////////////////////////////////////////// > . * column title, panel title, and slb_pan_nte = panel notes . global slb_col "price"

. global slb_pan "current panel results"

. global slb_pan_nte "general notes"

. . * eso = esttab options . global slb_eso "label mtitles p stats(N ${stc_sca}) star(* 0.10 ** 0.05 *** 0.01)"

. global slb_tex_eso "booktabs ${slb_eso}"

. . ///////////////////////////////////////////////// > ///--- B1. Column Specific Strings > ///////////////////////////////////////////////// > . * Column titling, some columns get column specific titles . global slb_col_3 "wgt"

. global slb_col_4 "areg"

. global slb_col_5 "gear <= 3"

. global slb_col_6 "reg"

. global slb_col_7 "areg"

. . * change regression method for column 4 . global stc_rgc_col_4 "areg"

. global stc_opt_col_4 ", absorb(foreign)"

. global stc_rgc_col_7 "areg"

. global stc_opt_col_7 ", absorb(foreign)"

. . * this means the third column's lhs var will be weight . global svr_lhs_col_3 "weight"

. . * below changing condition for 5th and 3rd column, append to existing conditions . global sif_cdn_col_5 "& gear_ratio <= 3"

. global sif_cdn_col_3 `"& trunk != 5 & ~strpos(make, "Ford")"'

. . * append these variables to column 4 and 5 estimations . global svr_rhs_col_4 "weight"

. global svr_rhs_col_5 "turn"

. . ///////////////////////////////////////////////// > ///--- B2. Panel Specific Strings > ///////////////////////////////////////////////// > . * Panel titling, 1 2 3 get panel specific titles, other use base . global slb_pan_1 "Panel A, foreign == 0"

. global slb_pan_2 "Panel B, foreign == 1"

. global slb_pan_3 "Panel C, length >= 190"

. . * Panel Specific Notes . global slb_pan_nte_1 `""This panel only includes foreign == 0. Absorb no effects.""'

. global slb_pan_nte_2 `""This panel then focuses only on foreign == 1""'

. global slb_pan_nte_2 `"${slb_pan_nte_2} "Hi there, more notes next line""'

. global slb_pan_nte_5 `""This panel is the 5th" "Yes it is the 5th, so what""'

. . * the 3rd panel and 6 panel lhs variable is mpg, note column override panel lhs . global svr_lhs_pan_3 "mpg"

. global svr_lhs_pan_6 "mpg"

. . * panel specific conditioning, appending to column and base conditioning . global sif_cdn_pan_1 "& foreign == 0"

. global sif_cdn_pan_2 "& foreign == 1"

. global sif_cdn_pan_3 "& length >= 190"

. . * panel specific rhs variables, append to column and base . global svr_rhs_pan_1 "mpg headroom"

. global svr_rhs_pan_4 "mpg"

. . * keeping . global svr_kep_pan_1 "${svr_rhs_pan_1} ${svr_rhs_col_1} ${svr_rhs_col_5}"

. global svr_kep_pan_4 "${svr_rhs_pan_4} ${svr_rhs_col_1} ${svr_rhs_col_5}"

. . ///////////////////////////////////////////////// > ///--- B3. Panel and Column Specific Strings > ///////////////////////////////////////////////// > . * RHS for panel 5 and column 4 will have two more covariates . global svr_rhs_pan_5_col_4 "length turn"

. global svr_kep_pan_4 "${svr_kep_pan_4} ${svr_rhs_pan_5_col_4}"

. . ///////////////////////////////////////////////// > ///--- C. Define Regression Strings > ///////////////////////////////////////////////// > . foreach it_pan_ctr of numlist 1(1)$it_pan_cnt { 2. foreach it_col_ctr of numlist 1(1)$it_col_cnt { 3. . ///--- Counters > global it_col_ctr "`it_col_ctr'" 4. global it_pan_ctr "`it_pan_ctr'" 5. . ///--- Reset Strings to Default Always, _u = use > . * if there are panel or column specific values, replace, eith col or row specific . * generates: stc_rgc_u and stc_opt_u . global stc_rgc_u "${stc_rgc}" 6. global stc_opt_u "${stc_opt}" 7. global svr_lhs_u "${svr_lhs}" 8. global st_ls_rep "stc_rgc stc_opt svr_lhs" 9. foreach st_seg in $st_ls_rep { 10. global st_seg "`st_seg'" 11. . * di `"${st_seg}_pan_${it_pan_ctr}: ${${st_seg}_pan_${it_pan_ctr}}"' . * di `"${st_seg}_col_${it_col_ctr}: ${${st_seg}_col_${it_col_ctr}}"' . * di `"${st_seg}_pan_${it_pan_ctr}_col_${it_col_ctr}: ${${st_seg}_pan_${it_pan_ctr}_col_${it_col_ctr}}"' . . if (`"${${st_seg}_pan_${it_pan_ctr}}"' != "") { 12. global ${st_seg}_u `"${${st_seg}_pan_${it_pan_ctr}}"' 13. } 14. else if (`"${${st_seg}_col_${it_col_ctr}}"' != "") { 15. global ${st_seg}_u `"${${st_seg}_col_${it_col_ctr}}"' 16. } 17. else if (`"${${st_seg}_pan_${it_pan_ctr}_col_${it_col_ctr}}"' != "") { 18. global ${st_seg}_u `"${${st_seg}_pan_${it_pan_ctr}_col_${it_col_ctr}}"' 19. } 20. * di `"${st_seg}_u: ${${st_seg}_u}"' . } 21. . * if there are panel or column specific values, append . global svr_rhs_u "${svr_rhs} ${svr_rhs_pan_${it_pan_ctr}} ${svr_rhs_col_${it_col_ctr}}" 22. global svr_cov_u "${svr_cov} ${svr_cov_pan_${it_pan_ctr}} ${svr_cov_col_${it_col_ctr}}" 23. global sif_cdn_u `"${sif_cdn} ${sif_cdn_pan_${it_pan_ctr}} ${sif_cdn_col_${it_col_ctr}}"' 24. . ///--- Compose Regression String > global srg_pan_${it_pan_ctr}_col_${it_col_ctr} `"${stc_rgc_u} ${svr_lhs_u} ${svr_rhs_u} ${svr_cov_u} ${sif_cdn_u} ${stc_opt_u}"' 25. . ///--- Display Regression String > di "PAN={$it_pan_ctr}, COL={$it_col_ctr}" 26. di `"${srg_pan_${it_pan_ctr}_col_${it_col_ctr}}"' 27. . } 28. } PAN={1}, COL={1} reg price rep78 mpg headroom gear_ratio if price !=. & foreign !=. & foreign == 0 , robust PAN={1}, COL={2} reg price rep78 mpg headroom gear_ratio if price !=. & foreign !=. & foreign == 0 , robust PAN={1}, COL={3} reg weight rep78 mpg headroom gear_ratio if price !=. & foreign !=. & foreign == 0 & trunk != 5 & ~strpos(make, "Ford") , robust PAN={1}, COL={4} areg price rep78 mpg headroom weight gear_ratio if price !=. & foreign !=. & foreign == 0 , absorb(foreign) PAN={1}, COL={5} reg price rep78 mpg headroom turn gear_ratio if price !=. & foreign !=. & foreign == 0 & gear_ratio <= 3 , robust PAN={1}, COL={6} reg price rep78 mpg headroom gear_ratio if price !=. & foreign !=. & foreign == 0 , robust PAN={1}, COL={7} areg price rep78 mpg headroom gear_ratio if price !=. & foreign !=. & foreign == 0 , absorb(foreign) PAN={2}, COL={1} reg price rep78 gear_ratio if price !=. & foreign !=. & foreign == 1 , robust PAN={2}, COL={2} reg price rep78 gear_ratio if price !=. & foreign !=. & foreign == 1 , robust PAN={2}, COL={3} reg weight rep78 gear_ratio if price !=. & foreign !=. & foreign == 1 & trunk != 5 & ~strpos(make, "Ford") , robust PAN={2}, COL={4} areg price rep78 weight gear_ratio if price !=. & foreign !=. & foreign == 1 , absorb(foreign) PAN={2}, COL={5} reg price rep78 turn gear_ratio if price !=. & foreign !=. & foreign == 1 & gear_ratio <= 3 , robust PAN={2}, COL={6} reg price rep78 gear_ratio if price !=. & foreign !=. & foreign == 1 , robust PAN={2}, COL={7} areg price rep78 gear_ratio if price !=. & foreign !=. & foreign == 1 , absorb(foreign) PAN={3}, COL={1} reg mpg rep78 gear_ratio if price !=. & foreign !=. & length >= 190 , robust PAN={3}, COL={2} reg mpg rep78 gear_ratio if price !=. & foreign !=. & length >= 190 , robust PAN={3}, COL={3} reg mpg rep78 gear_ratio if price !=. & foreign !=. & length >= 190 & trunk != 5 & ~strpos(make, "Ford") , robust PAN={3}, COL={4} areg mpg rep78 weight gear_ratio if price !=. & foreign !=. & length >= 190 , absorb(foreign) PAN={3}, COL={5} reg mpg rep78 turn gear_ratio if price !=. & foreign !=. & length >= 190 & gear_ratio <= 3 , robust PAN={3}, COL={6} reg mpg rep78 gear_ratio if price !=. & foreign !=. & length >= 190 , robust PAN={3}, COL={7} areg mpg rep78 gear_ratio if price !=. & foreign !=. & length >= 190 , absorb(foreign) PAN={4}, COL={1} reg price rep78 mpg gear_ratio if price !=. & foreign !=. , robust PAN={4}, COL={2} reg price rep78 mpg gear_ratio if price !=. & foreign !=. , robust PAN={4}, COL={3} reg weight rep78 mpg gear_ratio if price !=. & foreign !=. & trunk != 5 & ~strpos(make, "Ford") , robust PAN={4}, COL={4} areg price rep78 mpg weight gear_ratio if price !=. & foreign !=. , absorb(foreign) PAN={4}, COL={5} reg price rep78 mpg turn gear_ratio if price !=. & foreign !=. & gear_ratio <= 3 , robust PAN={4}, COL={6} reg price rep78 mpg gear_ratio if price !=. & foreign !=. , robust PAN={4}, COL={7} areg price rep78 mpg gear_ratio if price !=. & foreign !=. , absorb(foreign) PAN={5}, COL={1} reg price rep78 gear_ratio if price !=. & foreign !=. , robust PAN={5}, COL={2} reg price rep78 gear_ratio if price !=. & foreign !=. , robust PAN={5}, COL={3} reg weight rep78 gear_ratio if price !=. & foreign !=. & trunk != 5 & ~strpos(make, "Ford") , robust PAN={5}, COL={4} areg price rep78 weight gear_ratio if price !=. & foreign !=. , absorb(foreign) PAN={5}, COL={5} reg price rep78 turn gear_ratio if price !=. & foreign !=. & gear_ratio <= 3 , robust PAN={5}, COL={6} reg price rep78 gear_ratio if price !=. & foreign !=. , robust PAN={5}, COL={7} areg price rep78 gear_ratio if price !=. & foreign !=. , absorb(foreign) PAN={6}, COL={1} reg mpg rep78 gear_ratio if price !=. & foreign !=. , robust PAN={6}, COL={2} reg mpg rep78 gear_ratio if price !=. & foreign !=. , robust PAN={6}, COL={3} reg mpg rep78 gear_ratio if price !=. & foreign !=. & trunk != 5 & ~strpos(make, "Ford") , robust PAN={6}, COL={4} areg mpg rep78 weight gear_ratio if price !=. & foreign !=. , absorb(foreign) PAN={6}, COL={5} reg mpg rep78 turn gear_ratio if price !=. & foreign !=. & gear_ratio <= 3 , robust PAN={6}, COL={6} reg mpg rep78 gear_ratio if price !=. & foreign !=. , robust PAN={6}, COL={7} areg mpg rep78 gear_ratio if price !=. & foreign !=. , absorb(foreign)

. . ///////////////////////////////////////////////// > ///--- D. Run Regressions > ///////////////////////////////////////////////// > . eststo clear

. global it_reg_ctr = 0

. . ///--- Loop over panels > foreach it_pan_ctr of numlist 1(1)$it_pan_cnt { 2. . ///--- Counters > global it_pan_ctr "`it_pan_ctr'" 3. . ///--- Model Store Name > global st_cur_sm_stor "smd_${it_pan_ctr}_m" 4. global ${st_cur_sm_stor} "" 5. . ///--- Loop over regression columns > foreach it_col_ctr of numlist 1(1)$it_col_cnt { 6. . ///--- Counters > global it_col_ctr "`it_col_ctr'" 7. . global it_reg_ctr = ${it_reg_ctr} + 1 8. global st_cur_srg_name "srg_pan_${it_pan_ctr}_col_${it_col_ctr}" 9. . ///--- Regression String Name > di "PAN={$it_pan_ctr}, COL={$it_col_ctr}, ${st_cur_srg_name}" 10. di `"${${st_cur_srg_name}}"' 11. . ///--- Reset Strings to Default Always > global slb_col_u "${slb_col}" 12. global st_ls_rep "slb_col" 13. foreach st_seg in $st_ls_rep { 14. global st_seg "`st_seg'" 15. if ("${${st_seg}_${it_col_ctr}}" != "") { 16. global ${st_seg}_u `"${${st_seg}_${it_col_ctr}}"' 17. } 18. } 19. . ///--- Regress > capture $quiornot { 20. eststo m${it_reg_ctr}, title("${slb_col_u}") : ${$st_cur_srg_name} 21. } 22. if _rc!=0 { 23. ///--- This means this this regression failed, proceed with empty col > * Generate a fake observation to create a new estimated model . * Then replace the observation N by setting it to 0, otherwise N = 1 . capture drop aaa 24. gen aaa = 0 if _n == 1 25. eststo m${it_reg_ctr}, title("${slb_col_u}") : estpost tabstat aaa , statistics(n) c(s) 26. estadd scalar N = 0, replace 27. } 28. . ///--- Estadd Controls > * foreach st_scalar_name in $stc_sca { . * estadd local ${st_scalar_name} e(${st_scalar_name}) . * } . . ///--- Track Regression Store > global $st_cur_sm_stor "${${st_cur_sm_stor}} m${it_reg_ctr}" 29. } 30. } PAN={1}, COL={1}, srg_pan_1_col_1 reg price rep78 mpg headroom gear_ratio if price !=. & foreign !=. & foreign == 0 , robust PAN={1}, COL={2}, srg_pan_1_col_2 reg price rep78 mpg headroom gear_ratio if price !=. & foreign !=. & foreign == 0 , robust PAN={1}, COL={3}, srg_pan_1_col_3 reg weight rep78 mpg headroom gear_ratio if price !=. & foreign !=. & foreign == 0 & trunk != 5 & ~strpos(make, "Ford") , robust PAN={1}, COL={4}, srg_pan_1_col_4 areg price rep78 mpg headroom weight gear_ratio if price !=. & foreign !=. & foreign == 0 , absorb(foreign) PAN={1}, COL={5}, srg_pan_1_col_5 reg price rep78 mpg headroom turn gear_ratio if price !=. & foreign !=. & foreign == 0 & gear_ratio <= 3 , robust PAN={1}, COL={6}, srg_pan_1_col_6 reg price rep78 mpg headroom gear_ratio if price !=. & foreign !=. & foreign == 0 , robust PAN={1}, COL={7}, srg_pan_1_col_7 areg price rep78 mpg headroom gear_ratio if price !=. & foreign !=. & foreign == 0 , absorb(foreign) PAN={2}, COL={1}, srg_pan_2_col_1 reg price rep78 gear_ratio if price !=. & foreign !=. & foreign == 1 , robust PAN={2}, COL={2}, srg_pan_2_col_2 reg price rep78 gear_ratio if price !=. & foreign !=. & foreign == 1 , robust PAN={2}, COL={3}, srg_pan_2_col_3 reg weight rep78 gear_ratio if price !=. & foreign !=. & foreign == 1 & trunk != 5 & ~strpos(make, "Ford") , robust PAN={2}, COL={4}, srg_pan_2_col_4 areg price rep78 weight gear_ratio if price !=. & foreign !=. & foreign == 1 , absorb(foreign) PAN={2}, COL={5}, srg_pan_2_col_5 reg price rep78 turn gear_ratio if price !=. & foreign !=. & foreign == 1 & gear_ratio <= 3 , robust (73 missing values generated)

Summary statistics: count for variables: aaa

| e(count) -------------+----------- aaa | 1

added scalar: e(N) = 0 PAN={2}, COL={6}, srg_pan_2_col_6 reg price rep78 gear_ratio if price !=. & foreign !=. & foreign == 1 , robust PAN={2}, COL={7}, srg_pan_2_col_7 areg price rep78 gear_ratio if price !=. & foreign !=. & foreign == 1 , absorb(foreign) PAN={3}, COL={1}, srg_pan_3_col_1 reg mpg rep78 gear_ratio if price !=. & foreign !=. & length >= 190 , robust PAN={3}, COL={2}, srg_pan_3_col_2 reg mpg rep78 gear_ratio if price !=. & foreign !=. & length >= 190 , robust PAN={3}, COL={3}, srg_pan_3_col_3 reg mpg rep78 gear_ratio if price !=. & foreign !=. & length >= 190 & trunk != 5 & ~strpos(make, "Ford") , robust PAN={3}, COL={4}, srg_pan_3_col_4 areg mpg rep78 weight gear_ratio if price !=. & foreign !=. & length >= 190 , absorb(foreign) PAN={3}, COL={5}, srg_pan_3_col_5 reg mpg rep78 turn gear_ratio if price !=. & foreign !=. & length >= 190 & gear_ratio <= 3 , robust PAN={3}, COL={6}, srg_pan_3_col_6 reg mpg rep78 gear_ratio if price !=. & foreign !=. & length >= 190 , robust PAN={3}, COL={7}, srg_pan_3_col_7 areg mpg rep78 gear_ratio if price !=. & foreign !=. & length >= 190 , absorb(foreign) PAN={4}, COL={1}, srg_pan_4_col_1 reg price rep78 mpg gear_ratio if price !=. & foreign !=. , robust PAN={4}, COL={2}, srg_pan_4_col_2 reg price rep78 mpg gear_ratio if price !=. & foreign !=. , robust PAN={4}, COL={3}, srg_pan_4_col_3 reg weight rep78 mpg gear_ratio if price !=. & foreign !=. & trunk != 5 & ~strpos(make, "Ford") , robust PAN={4}, COL={4}, srg_pan_4_col_4 areg price rep78 mpg weight gear_ratio if price !=. & foreign !=. , absorb(foreign) PAN={4}, COL={5}, srg_pan_4_col_5 reg price rep78 mpg turn gear_ratio if price !=. & foreign !=. & gear_ratio <= 3 , robust PAN={4}, COL={6}, srg_pan_4_col_6 reg price rep78 mpg gear_ratio if price !=. & foreign !=. , robust PAN={4}, COL={7}, srg_pan_4_col_7 areg price rep78 mpg gear_ratio if price !=. & foreign !=. , absorb(foreign) PAN={5}, COL={1}, srg_pan_5_col_1 reg price rep78 gear_ratio if price !=. & foreign !=. , robust PAN={5}, COL={2}, srg_pan_5_col_2 reg price rep78 gear_ratio if price !=. & foreign !=. , robust PAN={5}, COL={3}, srg_pan_5_col_3 reg weight rep78 gear_ratio if price !=. & foreign !=. & trunk != 5 & ~strpos(make, "Ford") , robust PAN={5}, COL={4}, srg_pan_5_col_4 areg price rep78 weight gear_ratio if price !=. & foreign !=. , absorb(foreign) PAN={5}, COL={5}, srg_pan_5_col_5 reg price rep78 turn gear_ratio if price !=. & foreign !=. & gear_ratio <= 3 , robust PAN={5}, COL={6}, srg_pan_5_col_6 reg price rep78 gear_ratio if price !=. & foreign !=. , robust PAN={5}, COL={7}, srg_pan_5_col_7 areg price rep78 gear_ratio if price !=. & foreign !=. , absorb(foreign) PAN={6}, COL={1}, srg_pan_6_col_1 reg mpg rep78 gear_ratio if price !=. & foreign !=. , robust PAN={6}, COL={2}, srg_pan_6_col_2 reg mpg rep78 gear_ratio if price !=. & foreign !=. , robust PAN={6}, COL={3}, srg_pan_6_col_3 reg mpg rep78 gear_ratio if price !=. & foreign !=. & trunk != 5 & ~strpos(make, "Ford") , robust PAN={6}, COL={4}, srg_pan_6_col_4 areg mpg rep78 weight gear_ratio if price !=. & foreign !=. , absorb(foreign) PAN={6}, COL={5}, srg_pan_6_col_5 reg mpg rep78 turn gear_ratio if price !=. & foreign !=. & gear_ratio <= 3 , robust PAN={6}, COL={6}, srg_pan_6_col_6 reg mpg rep78 gear_ratio if price !=. & foreign !=. , robust PAN={6}, COL={7}, srg_pan_6_col_7 areg mpg rep78 gear_ratio if price !=. & foreign !=. , absorb(foreign)

. . di "${${st_cur_sm_stor}}" m36 m37 m38 m39 m40 m41 m42

. . ///--- Regression Panel String list > foreach it_pan_ctr of numlist 1(1)$it_pan_cnt { 2. global it_pan_ctr "`it_pan_ctr'" 3. global st_cur_sm_stor "smd_${it_pan_ctr}_m" 4. di "${st_cur_sm_stor}" 5. } smd_1_m smd_2_m smd_3_m smd_4_m smd_5_m smd_6_m

. . ///////////////////////////////////////////////// > ///--- E. Show Results > ///////////////////////////////////////////////// > . foreach it_pan_ctr of numlist 1(1)$it_pan_cnt { 2. . global it_pan_ctr "`it_pan_ctr'" 3. . global slb_eso_u "${slb_eso}" 4. global slb_tex_eso_u "${slb_tex_eso}" 5. . global slb_pan_u "${slb_pan}" 6. global slb_pan_nte_u "${slb_pan_nte}" 7. . global st_ls_rep "slb_pan slb_pan_nte" 8. foreach st_seg in $st_ls_rep { 9. global st_seg "`st_seg'" 10. if (`"${${st_seg}_${it_pan_ctr}}"' != "") { 11. global ${st_seg}_u `"${${st_seg}_${it_pan_ctr}}"' 12. } 13. } 14. . global svr_kep_u "${svr_kep} ${svr_kep_pan_${it_pan_ctr}}" 15. global st_esttab_opts_main `"addnotes(${slb_pan_nte_u}) title("${slb_pan_u}") keep(${svr_kep_u}) order(${svr_kep_u})"' 16. global st_esttab_opts_tex `"${st_esttab_opts_main} ${slb_tex_eso_u}"' 17. global st_esttab_opts_oth `"${st_esttab_opts_main} ${slb_eso_u}"' 18. . di "MODELS: ${smd_${it_pan_ctr}_m}" 19. di `"st_esttab_opts_main: ${st_esttab_opts_main}"' 20. . ///--- output to log > esttab ${smd_${it_pan_ctr}_m}, ${st_esttab_opts_oth} 21. . ///--- save results to html, rtf, as well as tex > if ($it_pan_ctr == 1) { 22. global st_replace "replace" 23. } 24. else { 25. global st_replace "append" 26. } 27. esttab ${smd_${it_pan_ctr}_m} using "${st_tab_html}", ${st_esttab_opts_oth} $st_replace 28. esttab ${smd_${it_pan_ctr}_m} using "${st_tab_rtf}", ${st_esttab_opts_oth} $st_replace 29. esttab ${smd_${it_pan_ctr}_m} using "${st_tab_tex}", ${st_esttab_opts_tex} $st_replace 30. . } MODELS: m1 m2 m3 m4 m5 m6 m7 st_esttab_opts_main: addnotes("This panel only includes foreign == 0. Absorb no effects.") title("Panel A, foreign == 0") keep(rep78 mpg headroom turn) order(rep78 mpg headroom turn)

Panel A, foreign == 0 ------------------------------------------------------------------------------------------------------------------------------------ (1) (2) (3) (4) (5) (6) (7) price price wgt areg gear <= 3 reg areg ------------------------------------------------------------------------------------------------------------------------------------ Repair Record 1978 404.2 404.2 71.68* 215.3 297.7 404.2 404.2 (0.252) (0.252) (0.063) (0.602) (0.547) (0.252) (0.380)

Mileage (mpg) -226.9** -226.9** -107.8*** 167.5 -175.7 -226.9** -226.9** (0.046) (0.046) (0.000) (0.261) (0.409) (0.046) (0.036)

Headroom (in.) -426.0 -426.0 -27.26 -470.6 -431.9 -426.0 -426.0 (0.191) (0.191) (0.535) (0.259) (0.382) (0.191) (0.361)

Turn Circle (ft.) 126.7 (0.499) ------------------------------------------------------------------------------------------------------------------------------------ N 48 48 46 48 37 48 48 r2 0.431 0.431 0.792 0.558 0.450 0.431 0.431 rank 5 5 5 6 6 5 5 ------------------------------------------------------------------------------------------------------------------------------------ p-values in parentheses This panel only includes foreign == 0. Absorb no effects. * p<0.10, ** p<0.05, *** p<0.01 (output written to ~\Stata4Econ\reglin\multipanel\allpurpose\allpurpose_tab.html) (output written to ~\Stata4Econ\reglin\multipanel\allpurpose\allpurpose_tab.rtf) (output written to ~\Stata4Econ\reglin\multipanel\allpurpose\allpurpose_tab_texbody.tex) MODELS: m8 m9 m10 m11 m12 m13 m14 st_esttab_opts_main: addnotes("This panel then focuses only on foreign == 1" "Hi there, more notes next line") title("Panel B, foreign == 1") keep(rep78 ) order(rep78 )

Panel B, foreign == 1 ------------------------------------------------------------------------------------------------------------------------------------ (1) (2) (3) (4) (5) (6) (7) price price wgt areg gear <= 3 reg areg ------------------------------------------------------------------------------------------------------------------------------------ Repair Record 1978 182.2 182.2 50.78 -356.9 182.2 182.2 (0.761) (0.761) (0.472) (0.430) (0.761) (0.818) ------------------------------------------------------------------------------------------------------------------------------------ N 21 21 20 21 0 21 21 r2 0.0891 0.0891 0.400 0.735 0.0891 0.0891 rank 3 3 3 4 0 3 3 ------------------------------------------------------------------------------------------------------------------------------------ p-values in parentheses This panel then focuses only on foreign == 1 Hi there, more notes next line * p<0.10, ** p<0.05, *** p<0.01 (output written to ~\Stata4Econ\reglin\multipanel\allpurpose\allpurpose_tab.html) (output written to ~\Stata4Econ\reglin\multipanel\allpurpose\allpurpose_tab.rtf) (output written to ~\Stata4Econ\reglin\multipanel\allpurpose\allpurpose_tab_texbody.tex) MODELS: m15 m16 m17 m18 m19 m20 m21 st_esttab_opts_main: addnotes(general notes) title("Panel C, length >= 190") keep(rep78 ) order(rep78 )

Panel C, length >= 190 ------------------------------------------------------------------------------------------------------------------------------------ (1) (2) (3) (4) (5) (6) (7) price price wgt areg gear <= 3 reg areg ------------------------------------------------------------------------------------------------------------------------------------ Repair Record 1978 -0.297 -0.297 -0.297 0.272 -0.935 -0.297 -0.183 (0.526) (0.526) (0.526) (0.577) (0.117) (0.526) (0.769) ------------------------------------------------------------------------------------------------------------------------------------ N 36 36 36 36 31 36 36 r2 0.174 0.174 0.174 0.533 0.431 0.174 0.178 rank 3 3 3 4 4 3 3 ------------------------------------------------------------------------------------------------------------------------------------ p-values in parentheses general notes * p<0.10, ** p<0.05, *** p<0.01 (output written to ~\Stata4Econ\reglin\multipanel\allpurpose\allpurpose_tab.html) (output written to ~\Stata4Econ\reglin\multipanel\allpurpose\allpurpose_tab.rtf) (output written to ~\Stata4Econ\reglin\multipanel\allpurpose\allpurpose_tab_texbody.tex) MODELS: m22 m23 m24 m25 m26 m27 m28 st_esttab_opts_main: addnotes(general notes) title("current panel results") keep(rep78 mpg turn length turn) order(rep78 mpg turn length turn)

current panel results ------------------------------------------------------------------------------------------------------------------------------------ (1) (2) (3) (4) (5) (6) (7) price price wgt areg gear <= 3 reg areg ------------------------------------------------------------------------------------------------------------------------------------ Repair Record 1978 774.6*** 774.6*** -6.772 65.63 614.0 774.6*** 248.6 (0.003) (0.003) (0.903) (0.844) (0.248) (0.003) (0.513)

Mileage (mpg) -210.6*** -210.6*** -63.16*** 46.88 -250.6 -210.6*** -180.2** (0.005) (0.005) (0.000) (0.548) (0.210) (0.005) (0.010)

Turn Circle (ft.) 12.54 (0.948)

Length (in.) ------------------------------------------------------------------------------------------------------------------------------------ N 69 69 66 69 38 69 69 r2 0.275 0.275 0.774 0.516 0.383 0.275 0.357 rank 4 4 4 5 5 4 4 ------------------------------------------------------------------------------------------------------------------------------------ p-values in parentheses general notes * p<0.10, ** p<0.05, *** p<0.01 (output written to ~\Stata4Econ\reglin\multipanel\allpurpose\allpurpose_tab.html) (output written to ~\Stata4Econ\reglin\multipanel\allpurpose\allpurpose_tab.rtf) (output written to ~\Stata4Econ\reglin\multipanel\allpurpose\allpurpose_tab_texbody.tex) MODELS: m29 m30 m31 m32 m33 m34 m35 st_esttab_opts_main: addnotes("This panel is the 5th" "Yes it is the 5th, so what") title("current panel results") keep(rep78 ) order(rep78 )

current panel results ------------------------------------------------------------------------------------------------------------------------------------ (1) (2) (3) (4) (5) (6) (7) price price wgt areg gear <= 3 reg areg ------------------------------------------------------------------------------------------------------------------------------------ Repair Record 1978 575.2** 575.2** -62.11 118.3 768.2 575.2** 5.905 (0.043) (0.043) (0.403) (0.712) (0.199) (0.043) (0.988) ------------------------------------------------------------------------------------------------------------------------------------ N 69 69 66 69 38 69 69 r2 0.176 0.176 0.648 0.513 0.331 0.176 0.287 rank 3 3 3 4 4 3 3 ------------------------------------------------------------------------------------------------------------------------------------ p-values in parentheses This panel is the 5th Yes it is the 5th, so what * p<0.10, ** p<0.05, *** p<0.01 (output written to ~\Stata4Econ\reglin\multipanel\allpurpose\allpurpose_tab.html) (output written to ~\Stata4Econ\reglin\multipanel\allpurpose\allpurpose_tab.rtf) (output written to ~\Stata4Econ\reglin\multipanel\allpurpose\allpurpose_tab_texbody.tex) MODELS: m36 m37 m38 m39 m40 m41 m42 st_esttab_opts_main: addnotes(general notes) title("current panel results") keep(rep78 ) order(rep78 )

current panel results ------------------------------------------------------------------------------------------------------------------------------------ (1) (2) (3) (4) (5) (6) (7) price price wgt areg gear <= 3 reg areg ------------------------------------------------------------------------------------------------------------------------------------ Repair Record 1978 0.947 0.947 0.876 1.123** -0.615 0.947 1.347** (0.195) (0.195) (0.236) (0.033) (0.528) (0.195) (0.048) ------------------------------------------------------------------------------------------------------------------------------------ N 69 69 66 69 38 69 69 r2 0.452 0.452 0.448 0.686 0.498 0.452 0.466 rank 3 3 3 4 4 3 3 ------------------------------------------------------------------------------------------------------------------------------------ p-values in parentheses general notes * p<0.10, ** p<0.05, *** p<0.01 (output written to ~\Stata4Econ\reglin\multipanel\allpurpose\allpurpose_tab.html) (output written to ~\Stata4Econ\reglin\multipanel\allpurpose\allpurpose_tab.rtf) (output written to ~\Stata4Econ\reglin\multipanel\allpurpose\allpurpose_tab_texbody.tex)

. . ///////////////////////////////////////////////// > ///--- F. Log to PDF etc > ///////////////////////////////////////////////// > . ///--- End Log and to HTML > log close name: <unnamed> log: C:\Users\fan\Stata4Econ\reglin\multipanel\allpurpose\allpurpose.smcl log type: smcl closed on: 9 Apr 2020, 11:23:07 -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------