Panel data correlation

#1
In a panel dataset of multiple years and multiple countries, what is best practice for running correlations among variables? I know that pooling by both countries and years is not recommended.

Is restricting instead by both country and year the preferred method? Or just by either one, country or year?

Can anyone please outline the pros and cons of each?