Dear Stata users,
I usually use tabstat to get summary statistics of varlists. It performs very well. However, sometimes I also want to get row mean of varlists besides means of separate variables. So, (without resorting to egen, mean() function and generating a new variable) is there any command could do this?
I usually use tabstat to get summary statistics of varlists. It performs very well. However, sometimes I also want to get row mean of varlists besides means of separate variables. So, (without resorting to egen, mean() function and generating a new variable) is there any command could do this?
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(gnp1970 gnp1980 gnp1990) byte quarter 3922 5310 6830.4 1 3922.3 5190.1 6853.2 2 3961.3 5179.2 6837.5 3 3931 5253.7 6804.6 4 4027.3 5330.3 6747.1 1 4042 5306.6 6766.9 2 4064.7 5341.8 6781.2 3 4072.9 5286.2 6821 4 4149.8 5206.1 6883.4 1 4232.5 5236.8 6937.5 2 4272.8 5212.8 6980.2 3 4343.9 5221.7 7067.7 4 4439.6 5255 7065.9 1 4475.9 5365.6 7096.8 2 4471.4 5448.3 7118.6 3 4495.1 5540.5 7213 4 4475.4 5641.4 7278.2 1 4492.4 5707.5 7369.2 2 4442.4 5749.5 7403.2 3 4430.2 5787.3 7494.8 4 4361.7 5818.1 7519 1 4403.2 5870.3 7531.4 2 4471.7 5954.9 7572.7 3 4531.8 5996.7 7645.4 4 4620.6 6038.3 7703.3 1 4655.6 6042.6 7819.6 2 4677 6097.5 7853.8 3 4720.7 6126 7948.2 4 4791.9 6157.2 8024.3 1 4852.2 6221 8148.8 2 4924.3 6266.3 8233.2 3 4922.2 6372 8289.6 4 4958.8 6423.8 8432.1 1 5107.7 6485.4 8476.3 2 5155.2 6504.8 8560 3 5227.4 6581 8731.6 4 5236.7 6668 8843.8 1 5244.9 6691.3 8910.8 2 5280.1 6727.1 9031.1 3 5296.6 6748.5 9204.7 4 end
Code:
. tabstat gnp1970 gnp1980 gnp1990, by(quarter) Summary statistics: mean by categories of: quarter quarter | gnp1970 gnp1980 gnp1990 rowmeanof70/80/90 ---------+------------------------------ 1 | 4498.38 5784.82 7532.75 5938.65 2 | 4542.87 5811.72 7591.05 5981.88 3 | 4572.09 5848.22 7637.15 6019.15 4 | 4597.18 5891.36 7722.06 6070.20 ---------+------------------------------ Total | 4552.63 5834.03 7620.752 ----------------------------------------
Comment