Hi!
I'm trying to add a "total" row to a data frame such that it corresponds to the sum of all my groups' observations (similar issue to https://www.statalist.org/forums/for...sting-variable).
I would like to use the method that is shown in this already solved topic, but for now I don't see how using either tabdisp or tag will help me to generate this new total row.
In short, considering this code :
sysuse auto, clear
collapse(sum) price, by(foreign)
How do I add a third row that shows "total" for the foreign variable and the sum of the two figures above for the price variable ?
Many thanks !
Baptiste
Related Posts with Collapse by groups : add a total row
Merging multiple Spss data sets into STATAHi, I'm trying to merge a few UNICEF MICS survey data files together which are on Spss onto stata, f…
Specification of funnel plot with -funnelcompar-Hi Statalisters I want to assess county differences in medication rates in Norway to detect outlier…
Specification of funnel plot with -funnelcompar-Hi Statalisters I want to assess county differences in medication rates in Norway to detect outlier…
Generating a new variable based on several specified conditionsDear Stata-Community, I am currently working on a paper in which I want to create a variable that in…
Panel data with fixed effects model having dummy/time-invariant variables in data setGreetings, I'm trying to conduct FE-model test on my panel data set. The panel consists of 116 comp…
Subscribe to:
Post Comments (Atom)
0 Response to Collapse by groups : add a total row
Post a Comment