Example illustrated with auto data in Stata
# without controls and if you want to find the mean of variable say price for foreign, where foreign consists of two groups (if foreign==0, domestic, and if foreign==1, it is Foreign).
sysuse auto, clear
Two ways:
1. Use linear reg (for simplicity I am assuming linearity in variables)
reg price foreign
Source | SS df MS Number of obs = 74
-------------+------------------------------ F( 1, 72) = 0.17
Model | 1507382.66 1 1507382.66 Prob > F = 0.6802
Residual | 633558013 72 8799416.85 R-squared = 0.0024
-------------+------------------------------ Adj R-squared = -0.0115
Total | 635065396 73 8699525.97 Root MSE = 2966.4
------------------------------------------------------------------------------
price | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
foreign | 312.2587 754.4488 0.41 0.680 -1191.708 1816.225
_cons | 6072.423 411.363 14.76 0.000 5252.386 6892.46
------------------------------------------------------------------------------
2: use by price
by foreign: sum price
-------------------------------------------------------------------------------------------------------------------
-> foreign = Domestic
Variable | Obs Mean Std. Dev. Min Max
-------------+--------------------------------------------------------
price | 52 6072.423 3097.104 3291 15906
-------------------------------------------------------------------------------------------------------------------
-> foreign = Foreign
Variable | Obs Mean Std. Dev. Min Max
-------------+--------------------------------------------------------
price | 22 6384.682 2621.915 3748 12990
If you compare two methods, you see that intercept in the first approach gives the mean price when foreign is domestic and coefficient on foreign plus the intercept gives the mean price for Foreign when foreign is Foreign.
# Now if you want to control other variables, there is only one way you can do that (of course there is matching which you already mentioned). You need to use linear regression (again for simplicity, I am assuming linearity in all variables). Say, you want to control for weight and length
reg price foreign weight length
Source | SS df MS Number of obs = 74
-------------+------------------------------ F( 3, 70) = 28.39
Model | 348565467 3 116188489 Prob > F = 0.0000
Residual | 286499930 70 4092856.14 R-squared = 0.5489
-------------+------------------------------ Adj R-squared = 0.5295
Total | 635065396 73 8699525.97 Root MSE = 2023.1
------------------------------------------------------------------------------
price | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
foreign | 3573.092 639.328 5.59 0.000 2297.992 4848.191
weight | 5.774712 .9594168 6.02 0.000 3.861215 7.688208
length | -91.37083 32.82833 -2.78 0.007 -156.8449 -25.89679
_cons | 4838.021 3742.01 1.29 0.200 -2625.183 12301.22
-----------------------------------------------
Now the intercept gives the mean price for domestic after controlling for length and weight and intercept plus coefficient on Foreign gives the mean price for Foreign after controlling for length and weight.
.