Announcement

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

  • Why the changes to 'table' in Stata 17?

    Hello--

    I'm just curious if anyone understands the reasoning behind the changes to the 'table' command for Stata 17. I work on a project that processes data using the same programs (modified as necessary) for each new year of data we receive. This year, when I tried to run the program in Stata 17 with the new year of data, I hit some errors. Firstly, 'table' no longer allows string variables. (Attempting to run such a line causes the code to break, so this is easily identified.) Secondly, 'table' no longer allows the 'row' option. Using the row option does not cause the code to break, so this took me a bit longer to identify--I had to scan the whole log output to find the note. Anyway, I am just curious what necessitated these changes. Any ideas?

    Thanks

  • #2
    If you add the command version 16 at the top of your do-file will let Stata run as you intended it. It is generally a good idea to tell Stata in which version you wrote your commands. Stata is very good at not breaking your code, but you first need to tell it what version it should use.

    As to why Stata rewrote table, this was very very long on the wish list of many Stata users. It now provides a common language for a lot of tables an the means to export to other programs like MS Word.
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment


    • #3
      This was the press release, as it were:: https://www.stata.com/new-in-stata/tables/

      Comment


      • #4
        Dear all, I would like to have the entire dofile for the classic table 1 generated by the new table command in stata 17. I would like to have the one for the statistical test result.

        Comment


        • #5
          This is better posed as a specific question and in a new thread, rather than posting in a different thread. There isn't "one" table command for those tables so you are best to build it yourself and ask for help as needed. Even something as common as "Table 1" (and I hate that name because it's completely uninformative) will look very different in different journals. As for "the one for the statistical test result", we can only guess what you mean by that.

          Comment


          • #6
            Dear Leonardo, thanks for your answer.
            First, I used this code
            table (var) (A16), ///
            statistic(mean A3 A8 A9 A10 A15) statistic(sd A3 A8 A3 A8 A9 A10 A15) ///
            statistic(fvfrequency A2 A4 A5_1 A5_2 A11_new A12 A13 A14) statistic(fvpercent A2 A4 A5_1 A5_2 A11_new A12 A13 A14)
            collect recode result fvfrequency = column1 fvpercent = column2 mean = column1 sd = column2
            collect layout (var) (A16#result[column1 column2])
            collect style cell var[A2 A4 A5_1 A5_2 A11_new A12 A13 A14]#result[column1 column2], nformat(%6.0fc)
            collect style cell var[A2 A4 A5_1 A5_2 A11_new A12 A13 A14]#result[column2], nformat(%6.1f) sformat("%s%%")
            collect style cell var[A3 A8 A9 A10 A15]#result[column1 column2], nformat(%6.1f)
            collect style cell var[A3 A8 A9 A10 A15]#result[column2], sformat("(%s)")
            collect style header result, level(hide)
            collect style row stack, nobinder spacer
            collect style cell border_block, border(right, pattern(nil))
            collect preview

            I got the table as wanted.
            Now, I used that one
            table (var) (A16), statistic(mean B2_11-B2_19) statistic(sd B2_11-B2_19)
            collect recode result mean = column1 sd = column2
            collect layout (var) (A16#result[column1 column2])
            collect style cell, nformat(%6.1f)
            collect style cell var[B2_11-B2_19]#result[column2], sformat("(%s)")
            collect style header result, level(hide)
            collect style row stack, nobinder
            collect style cell border_block, border(right, pattern(nil))
            collect preview
            The results in the énd column are not put in (.) as wanted.
            Plus, I got that message
            "(level B2_11-B2_19 of dimension var not found)" just after this line " collect style cell var[B2_11-B2_19]#result[column2], sformat("(%s)")".
            So I am confused.


            ​​​​​​​

            Comment

            Working...
            X