I did the following for too many variables:

Variable 1:
Code:
bysort year Industry: egen Industry_Mean_ROA = mean(ROA)
bysort year firm: gen Industry_Adjusted_ROA = ROA - Industry_Mean_ROA
Variable 2:
Code:
bysort year Industry: egen Industry_Mean_ROE = mean(ROE)
bysort year firm: gen Industry_Adjusted_ROE = ROE - Industry_Mean_ROE
However, I would like to use the loop function to do this as I have too many variables. The following did not work:
Code:
foreach v of varlist ROA  ROE {
    bysort year firm: gen Industry_Adjusted_`v' = `v' - { 
    bysort year Industry: mean(`v')
}
}
Thanks in advance