Hi all,
I am trying to let Stata loop over only certain files ending with _p in one folder. The files meant are named "2004_c_y_cross_pers_data_p", the year however varies 2004 2006 2008 2012 etc. till 2018. I tried adjusting the syntax by adding this part files "*_cross_eu_silc_pers_data_p.dta" but something does not work. Any clue about the right syntax? Thanks!

cd "Y:\Cross\All_countries"
local statafiles : dir . files "*.dta
foreach file of local statafiles {
tab PB020 if PY000 <0
}

Array