I have a panel data set, consisting of 125 countries, 36 years. I want to run an IV regression multible times and randomly drop 5 (of the 36 years) each time.

At the moment (see code below), I run a loop 20 times and each round I drop the last year. How can I drop 5 random years each round (and put them back before the next round)?

I had a look at bootstrapp, but it doesn't seem to work here, since the variable fadum_avg and other controls including it have to be newly calculated in each round of the loop.

Code:
postfile buffer coeff standart using mcs, replace

forval x=0/20{
    tsset obs year
    drop if year>(2006-`x')
    bysort risocode: egen fadum_avg=mean(fadum)
    
    foreach x of varlist all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec{
        drop `x'_faavg
        gen `x'_faavg=`x'*fadum_avg
    }
    tsset obs year
    gen instrument=l.US_wheat_production*fadum_avg
    bysort risocode: egen ln_rgdpch_avg=mean(ln_rgdpch)
        
    gen oil_fadum_avg=oil_price_2011_USD*fadum_avg
    gen US_income_fadum_avg=USA_ln_income*fadum_avg
    gen US_democ_pres_fadum_avg=US_president_democ*fadum_avg
    
    local US_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg"
    local weather_controls "all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"    
    
    sor risocode year
    
    ivreg2 intra_state (wheat_aid=instrument) c.recipient_pc_cereals_prod_avg#i.year c.cereal_pc_import_quantity_avg#i.year c.ln_rgdpch_avg#i.year ///
    c.real_us_nonfoodaid_ecaid_avg#i.year c.real_usmilaid_avg#i.year `weather_controls' `US_controls' i.year##i.wb_region_n i.risocode_n ,cluster(risocode) ffirst
    outreg2 wheat_aid using "T2_TESTneu5.xls", se noast nocons lab dec(5) adds(KP F-Stat, e(rkf))
    
    post buffer (_b[wheat_aid]) (_se[wheat_aid])
    
    //droppen
    drop ln_rgdpch_avg
    drop instrument
    drop fadum_avg
    drop oil_fadum_avg
    drop US_income_fadum_avg
    drop US_democ_pres_fadum_avg
}

postclose buffer