Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to change the format of two-way tables of frequencies

    Hello colleague,

    I have two categorical variables (education and gender) and I would like to produce a two-way table of frequencies but percents are reported in (%9.2f) format. I would like to find relative frequencies in format of format(%9.1f). Any idea how I may do that? Here is my code.

    Code:
    tabulate education gender, col nofreq

    Best,
    Anagaw
    Last edited by Anagaw Derseh; 04 Nov 2018, 14:14.

  • #2
    You might try the user contributed program tab2way available from SSC. It has a format() option that the built-in command tabulate lacks. Another user contributed program, Ian Watson's tabout (SSC), would also be suitable.

    Comment


    • #3
      With tabout you would use format(1p) to format it to "percentage with 1 decimal place."

      For examples of tabout tables visit the official on-line gallery and consult the User Guide (skip down to chapter 3). A similar Tabout user guide is available at ResearchGate (you may need to register to download it). But it has a number of really nice tables / crosstabs of survey data (& the Stata code to create them). Link

      From -help tabout-:
      Code:
       format indicates the number of decimal points. Unlike mainstream Stata, this option only requires a number. Do not enter % or f
       symbols. You can however, enter c for comma, p for percentage, and m for money (currency) and you can use the money option
       to specify the currency (see below). For example, you might enter f(0c 1p 1p 2) to produce: 1,291 9.2% 10.3% 23.93. The
       entries should be in the same order as the cells order, that is, if freq comes first, then 0c should come first if you want 0
       decimal points (with commas) as the format for frequencies.
      Last edited by David Benson; 18 Nov 2018, 23:16.

      Comment

      Working...
      X