To fill missing values with the mean value in a panel data, you can use the following command structure:
bys id: fillmissing varname, with(mean)
Where id is your panel id, such permno, company name, or country. And the varname is the name of the variable which contains missing values.