To computing residuals and predicting values


I am trying to compute residuals. In the first time, I do my regression such as :

regress v1 v2 v3 v4 v5 pays_encode1 pays_encode2 pays_encode3 pays_encode4 pays_encode5 pays_encode6 pays_encode7 pays_encode8 pays_encode9 pays_encode10 pays_encode11 pays_encode12 pays_encode13 pays_encode14 pays_encode15 pays_encode16 pays_encode17 pays_encode18 pays_encode19 pays_encode20 if annee == annee_encode2 & icb == icb_encode1, cluster ( isin_encode)

Then, I use the following code : predict resid, residuals.

Finally, I use "tab resid".

My problem is that the results are for all observations and not only for the term determined by the expression following "if", such as in function sector 1 and year 1 in the first regression.

According to you, is my programation right and how can I resolve my problem ?

Thank you so much for your precious help.

Best regards,