On Tue, 2 May 2006, Nick Cox wrote:
:The question in turn is what belongs in
:a "cell" of the table? -tabdisp- will
:show you tables of strings, but if
I was too vague. Take these data:
. list union pol_ if pol_!=., str(30)
     +--------------------------------------------+
     | union                              pol_dem |
     |--------------------------------------------|
  1. | bakery and confectionery worke..         1 |
  2. | communications association; am..         2 |
  3. | state, county and municipal wo..         2 |
  9. | switch men                               1 |
 11. | boot and shoe workers                    0 |
     |--------------------------------------------|
 12. | plate printers, die stampers a..         1 |
 14. | glass bottle blowers                     1 |
 15. | painters, decorators and paper..         0 |
 16. | stove mounters                           1 |
 18. | photo- engravers                         1 |
     |--------------------------------------------|
 19. | mechanics and foremen of naval..         1 |
 22. | hatters, cap and millinery wor..         2 |
 24. | laundry and dry cleaning                 1 |
     +--------------------------------------------+
I want to make a table of unions (strings) by pol_id (categorical var):
. tabdisp pol_dem if pol_dem!=., c(union)
--------------------------------
  pol_dem |                union
----------+---------------------
        0 | boot and shoe worker
        1 | bakery and confectio
        2 | communications assoc
--------------------------------
Aside from a preference for the categorical variable being the columns,
"what belongs in a cell" is a list of all the cases (strings) for each
category. That is, the information from
. by pol_: list union
-------------------------------------------------------------------------------
-> pol_dem = 0
     +---------------------------------------+
     |                                 union |
     |---------------------------------------|
  1. | painters, decorators and paperhangers |
  2. |                 boot and shoe workers |
     +---------------------------------------+
-------------------------------------------------------------------------------
-> pol_dem = 1
     +-----------------------------------------------------------------+
     |                                                           union |
     |-----------------------------------------------------------------|
  1. | bakery and confectionery workers' international union; american |
  2. |                                                photo- engravers |
  3. |                                            glass bottle blowers |
  4. |                                                      switch men |
  5. |             mechanics and foremen of naval shore establishments |
     |-----------------------------------------------------------------|
  6. |                      plate printers, die stampers and engravers |
  7. |                                        laundry and dry cleaning |
  8. |                                                  stove mounters |
     +-----------------------------------------------------------------+
-------------------------------------------------------------------------------
-> pol_dem = 2
     +--------------------------------------+
     |                                union |
     |--------------------------------------|
  1. |  state, county and municipal workers |
  2. | communications association; american |
  3. |   hatters, cap and millinery workers |
     +--------------------------------------+
Perhaps the answer is cut and paste.
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/