Announcement

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

  • Writing memory data to word table

    Hello

    As part of my job the results I get from Stata need to put into tables in a word document to show to my boss (He's not a statistician so doesn't want to see all of the output just a neat summary). Since the data is constantly growing the tables need to be reran and updated at least once a month (Sometimes more often). At first i was running the do file and then manually retyping the numbers into word, which as you can imagine is very tedious. Since then i have found ways to speed up this process, and currently my results overwrite the memory data, perfectly formatted as i would like in the table.

    I would really like to be able to read the results directly into a table in word, as this would save me a lot of copy and paste!
    Most of the commands I have seen looking around can read the results of a command into a word table (i.e putdocx and esttab) but i have yet to find a command that could read the memory data into a table.
    Any advice for a way to do this would be greatly appreciated!
    Thanks
    Cydney

  • #2
    Hi Cydney,

    It sounds like there should be something that can help you, but I don't think I understand what you mean by "memory data." Per the recommendations in the FAQ (in particular, section 12 about what to say about your data and examples), it would be helpful to show us some example data (toy data is fine) using -dataex- any any relevant code that shows us where your are starting from, and then perhaps how you would like your end result to appear.

    As some general advice, there are offcial commands like -putdocx- and -putexcel- that are quite flexible and can be used to create tables that are not just based on estimation commands. There are also a number of user-contributed commands, as you mention one of them, which I am less familiar with.

    Comment


    • #3
      Hi Leonardo,

      I can give example data but I'm not sure how helpful it will be.

      Code:
      clear
      set obs 4
      
      gen var = ""
      clear
      set obs 4
      
      gen var = ""
      replace var = "175-179" in 1
      replace var = "180-184" in 2
      replace var = "185-189" in 3
      replace var = "190-194" in 4
      
      gen case = ""
      replace case = "104" in 1
      replace case = "342" in 2
      replace case = "274" in 3
      replace case = "151" in 4
      
      gen control = ""
      replace control = "215" in 1
      replace control = "256" in 2
      replace control = "172" in 3
      replace control = "81" in 4
      
      gen or = ""
      replace or = "0.94" in 1
      replace or = "1.00" in 2
      replace or = "1.14" in 3
      replace or = "1.23" in 4
      Okay so imagine something like this but with more detail. The aim is to read this directly into a table in word i.e

      Click image for larger version

Name:	Example.png
Views:	1
Size:	29.4 KB
ID:	1505915


      I have tried looking through the forums and comments on different commands but non of them seemed to do what i was looking for :/

      Comment


      • #4
        After taking a closer look at the putdocx documentation i think this may actually be able to do what i am looking for.
        Thank you for the direction Leonardo!

        Comment


        • #5
          This can be done with one line of code using asdoc. See this example
          Code:
          ssc install asdoc
          sysuse auto
          asdoc list, replace
          Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	82.2 KB
ID:	1505962


          Want to know more about asdoc, see this half page introduction http://fintechprofessor.com/2018/02/...basic-example/
          Regards
          --------------------------------------------------
          Attaullah Shah, PhD.
          Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
          FinTechProfessor.com
          https://asdocx.com
          Check out my asdoc program, which sends outputs to MS Word.
          For more flexibility, consider using asdocx which can send Stata outputs to MS Word, Excel, LaTeX, or HTML.

          Comment

          Working...
          X