Dear Stata Forum,
I would like to use the "collect" command to create a table of results generated by xtsum. Unfortunately, after xtsum, the collect command does not have the dimension called "colname" that usually contains the list of variables names. Furthermore, only the statistics associated with the last variable are saved in the collection.
Is there some way to make the collect command save the variable names and all the results that show up in the xtsum output? Perhaps I need to run the xtsum command in a loop and then assemble results from multiple collections? Any tips would be appreciated.
My failed attempt to create the table is below.
Thanks,
Jeremy
I would like to use the "collect" command to create a table of results generated by xtsum. Unfortunately, after xtsum, the collect command does not have the dimension called "colname" that usually contains the list of variables names. Furthermore, only the statistics associated with the last variable are saved in the collection.
Is there some way to make the collect command save the variable names and all the results that show up in the xtsum output? Perhaps I need to run the xtsum command in a loop and then assemble results from multiple collections? Any tips would be appreciated.
My failed attempt to create the table is below.
Thanks,
Jeremy
Code:
sysuse bplong.dta *identify "patient" as the ID variable and "when" as the time variable xtset patient when *get results from xtsum and place them in a collection collect: xtsum bp sex *list the dimensions captured by the collect prefix *Problem: there is no dimension called "colname" which typically contains the list of variables collect dims *the collection only appears to hold the results from the last variable: sex collect layout (colname) (result[mean sd sd_b sd_w])
Comment