Hello everyone, I am a new beginner of Stata. I tried to run a stata code written by an author whose paper has already published. When I run the following code:
Code:
* Government spending
loc i = 1

preserve
forval h = 0/3 {
    parmby "qui xtreg g`h'_gspnd g0_milspnd_nc l.g0_gspnd warall l.g0_rgdp i.year, fe vce(cl cid)", ///
        saving(`"`t`h''"', replace) 
    }
        
* create dataset from estimates
drop _all
append using `"`t0'"' `"`t1'"' `"`t2'"' `"`t3'"' 
keep if parm=="g0_milspnd_nc"
gen idnum = _n - 1
        
* Normalize shock so that G is 1% of GDP on impact
foreach var of var *90 estimate {
    replace `var' = `var'/`=estimate[1]'
    }
        
* plot
tw scatter estimate idnum, ///
    msymbol(D) msize(large) mcolor(black)  || ///
line estimate  min90 max90 idnum, ///
    lc(black black black) lp(solid shortdash shortdash) lwidth(1.25 1 1) ///
    title("`tit`i''" , size(huge)) name(`file`i'', replace) ///
    xtitle("Years after shock", size(huge)) xlabel(0(1)3, labsize(huge) tp(i)) ///
    ytitle("`ytit`i''", size(huge))  ylabel(`ylab`i'',labsize(huge) angle(h) grid tp(i)) ymti(`ymti`i'', tp(i) grid) ysc(r(`ysc`i'')) /// 
    scheme(s1color) plotregion(sty(none) margin(zero)) graphregion(margin(small)) ///         
    legend(`leg') ///
yline(0, lc(black) lw(medthick))        
        
graph export "figures/Figure2_`file`i''.pdf", as(pdf) replace fontface("Georgia")

restore
When I run the above code, it occurs:
"nothing to restore
r(622);"
Then I use
Code:
set trace on
It seems the problem is the parmby
Code:
  ----------------------------------------------------- end parmby._parmby ---
  - return add
  - if "`fast'"=="" {
  = if ""=="" {
  - if "`restore'"=="norestore" {
  = if ""=="norestore" {
    restore,not
    }
  - else {
  - restore
nothing to restore
    }
    }
  --------------------------------------------------------------- end parmby ---
  }
How can I deal with this question, any helps are appreciated.