Hello everyone,

I am a beginner in Stata and encountered a problem while using putexcel.
I ran: bys year pct_nonwhite_5: sum i_fin_total_expend_per_ada [w=ada3].
In my data, pct_nonwhite_5 is a quintile variable ranging from 1 to 5, and year ranges from 2000 to 2019.
As a result, I see many tables/results by year and by pct_nonwhite_5 (year=2019 pct_nonwhite_5=1; year=2019 pct_nonwhite_5=2; year=2019 pct_nonwhite_5=3, etc.)
-> year = 2019, pct_nonwhite_5 = 1

Variable | Obs Weight Mean Std. Dev. Min Max
-------------+-----------------------------------------------------------------
i_fin_tota~a | 104 30073.4038 13113.5 3236.992 6507.106 36659.49

--------------------------------------------------------------------------------------
-> year = 2019, pct_nonwhite_5 = 2

Variable | Obs Weight Mean Std. Dev. Min Max
-------------+-----------------------------------------------------------------
i_fin_tota~a | 103 57752.7042 12671.59 2477.241 9403.23 24458.79

--------------------------------------------------------------------------------------
-> year = 2019, pct_nonwhite_5 = 3

Variable | Obs Weight Mean Std. Dev. Min Max
-------------+-----------------------------------------------------------------
i_fin_tota~a | 103 75173.4285 13141.43 2578.462 9883.942 28688.66

--------------------------------------------------------------------------------------
-> year = 2019, pct_nonwhite_5 = 4

Variable | Obs Weight Mean Std. Dev. Min Max
-------------+-----------------------------------------------------------------
i_fin_tota~a | 103 156746.606 13387.34 2396.398 10333.27 32401.17

--------------------------------------------------------------------------------------
-> year = 2019, pct_nonwhite_5 = 5

Variable | Obs Weight Mean Std. Dev. Min Max
-------------+-----------------------------------------------------------------
i_fin_tota~a | 103 494569.695 15122.61 3812.337 6877.485 32993.67

I want to save all the results to one excel sheet with A1: year, B1: pct_nonwhite_5, and C1: i_fin_total_expend_per_ada.
How would I code this so that I get the excel file I want?

Best,
Aaron