Announcement

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

  • Table 1

    Hi
    Usually I am using this command below to create table 1.

    Code:
     preserve
    
    cap erase table1.xlsx
    table1_mc, by(sex)  ///
    vars( ///
    Age contn %4.1f \ ///
    smoking cat \ ///
    education cat \ ///
    income cat \ ///
    bmi contn %4.1f \ ///
    bmicat cat \ ///
    lpa contn %4.1f \ ///
    lpa2c cat \ ///
    fg contn %4.1f \ ///
    HbA1C_status contn %4.1f \ ///
    HbA1C_ cat \ ///
    fbgdm cat \ ///
    BP_OUT_CALC_AVG_SYSTOLIC_BP contn %4.1f \ ///
    non_hdl contn %4.1f \ ///
    HANDGRIP_OUT_LEFT contn %4.1f \ ///
    HANDGRIP_OUT_RIGHT contn %4.1f \ ///
    mean_HANDGRIP contn %4.1f \ ///
    devided_mean_HANDGRIP contn %4.1f \ ///
    devided_HANDGRIP_OUT_RIGHT contn %4.1f \ ///
    devided_HANDGRIP_OUT_LEFT contn %4.1f \ ///
    BodyFatFFM contn %4.1f \ ///
    med_diab_tab cat \ ///
    med_insulin cat \ ///
    med_hbp cat \ ///
    ) ///
    total (before) percent onecol missing clear ///
    saving("table1.xlsx", replace)
    But now I want to create this table without specifying "by (sex)." Also, how can I get frequencies with percentages, as in this table I only got percentages?

  • #2
    • In line 4, take out "by(sex)"
    • In second line from the bottom, take out "percent"

    Comment


    • #3
      Originally posted by Ken Chui View Post
      • In line 4, take out "by(sex)"
      • In second line from the bottom, take out "percent"
      Yes, I already tried that, but it is not working. I got the error message "varlist not allowed".

      Comment


      • #4
        Without data sample it's hard to investigate. But here is a working shell that you can start from:

        Code:
        sysuse auto, clear
        
        table1_mc, ///
        vars( ///
        foreign bin %4.1f \ ///
        rep78 cat %4.1f \ ///
        ) ///
        onecol

        Comment


        • #5
          Originally posted by Ken Chui View Post
          Without data sample it's hard to investigate. But here is a working shell that you can start from:

          Code:
          sysuse auto, clear
          
          table1_mc, ///
          vars( ///
          foreign bin %4.1f \ ///
          rep78 cat %4.1f \ ///
          ) ///
          onecol

          Thank you very much; it is working. The problem was that I also removed the comma after mc.

          Comment

          Working...
          X