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
DSGE error(498): could not find steady-state of model under initial parameter vectorHello everyone, I'm trying to run a non-linear DSGE model but I'm facing an error saying "could not …
Removing the variable name and equals sign from legends without using legend(lab()) ?Hi, I am trying to create a series of Kaplan-Meier survival curves based on a series of categorical …
Implementing a loop in rclass programDear all, I would like to implement a loop over a dependent variable in an rclass program. This is…
Dropping observations of a variableHey all, Wonderful community here. I'm new to coding in stata. I was curious if someone could walk …
table creation after foreach and selecting variablesHello everybody and thanks in advance. I'm wondering how to create tables in Stata 16 after a loop v…
Subscribe to:
Post Comments (Atom)
0 Response to Collapse by groups : add a total row
Post a Comment