Hi STATALIST,

The following program runs fine when there is at least on observation in each sheet. but I don't have any observations in some sheets. I need to save those sheets in the data check_PAH file too.

So I need to have all named sheets either with observations or without observations in the data check_PAH.

Any advice on solving this problem please?

Regards,

levelsof sheets_name, local(levels)
local vlname: value label sheets_name
foreach L of local levels {
local vl: label `vlname' `L'
export excel centre studydescription_all Unknown1 using "U:\eDose Monitoring Data\data check_PAH" if centre==5 & Unknown1==`L' ///
,sheet("`vl'") sheetreplace firstrow(variables)
}