As we all know, if all explanatory variables are correlated with the error term, we called it the endogeneity problem and its against the Exogeneity assumption of OLS regression. I just want to know that if we generated error tern after regression running on STATA and then apply correlation analysis on all explanatory variables and the error term, should we able detect the endogeneity problem through this process or not?