I am looking at consolidating data from CRSP for companies with the same parent company. To do this, I am aggregating data under a group ID variable for a long list of variables.I have uploaded a do file of the code I am running because the macrolist is quite long. I am getting the error 'varlist required' for the loop which I assume is because the long local macro in the first part of the code is wrong somewhere. Any help would be greatly appreciated.