I'm having trouble using a foreach loop to construct a table. I have 4 variables, "debtgdp, dRGDP, Year, and Country." The forloop im trying to construct must calculate the mean and standard error of GDP growth (variable 'dRGDP') for the following debt/GDP buckets (variable 'debtgdp'): 0-30, 31-60, 61-90, 90+. The loop then must put these results into a 5 column table with countries in column 1, and the results for the debt buckets in columns 2-5, with the standard errors in parentheses under the means.
The part I'm having most trouble with is sorting my data into these debt buckets with the loop. I'm also unsure of which table command to use. I'm a beginner with stata especially when it comes to loops, so any kind of advice would be appreciated.
The part I'm having most trouble with is sorting my data into these debt buckets with the loop. I'm also unsure of which table command to use. I'm a beginner with stata especially when it comes to loops, so any kind of advice would be appreciated.
Comment