Hello,

I am sure this must be trivial, but I have had no luck with it so far. I am trying the new -collect- system of building tables in Stata 17, and cannot figure out how to make a couple types of edits.

Consider the MWE:

Code:
        sysuse auto, clear
        collect clear
        table (foreign) ()  if price < 10000, stat(mean mpg) name(t1)
        table (foreign) ()  if price >= 10000, stat(mean mpg) name(t1) append
        collect layout (foreign) (cmdset)
        collect label levels cmdset 1 "Cheap" 2 "Expensive", modify
        collect style header cmdset, title(hide)
        collect style cell cell_type[row-header]#foreign[.m],border(top,pattern(single))        
        collect style cell cell_type[item]#foreign[.m],border(top,pattern(single))
        collect style cell , nformat(%5.2f)                
        collect preview
which produces the output
Code:
-------------------------------
           |  Cheap   Expensive
-----------+-------------------
Car origin |                   
  Domestic |  20.73       14.88
  Foreign  |  25.70       15.50
-----------+-------------------
  Total    |  22.28       15.00
-------------------------------
Can anyone tell me
  1. how can I add a row to the bottom of the table that would tell us the observations in each column?
  2. how can I remove the "Car origin" title from its current location and into the top-left box that is currently empty?
  3. is there a way to introduce a gap between columns, for instance if we wanted the line above "Total" to be separated for the "Cheap" and "Expensive" columns?
Thank you in advance!