Announcement

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

  • #16
    Pandoc suggestions? There is an ado from Hua Peng buried on github, called "pandocmarkdown.ado". There is a revised version of this at https://github.com/hemken/pandoc-stata . Haghish has a pandoc command bundled in markdoc, but it is pretty bare (you have to specify most options by writing the pandoc arguments yourself). Markstat has a _pandoc command buried within it.
    None of these are documented (i.e. none have useful help files, that I know of).

    I'd like to see several of us collaborate on a common Stata -pandoc- command that could stand alone or be bundled with other commands like -markstat-. I would combine the features of -pandocmarkdown- and `_pandoc` (and my little revision adds the ability to echo `pandoc` errors, something I see German has also built into -markstat- for handling R errors! "Great minds ..."?!)

    As far as producing true tables, neither `markstat` nor `log2html` will do this for you. Your approach looks good (I'm unfamiliar with listtab), and the `putdocx` suggestion would work. Actually, Stata's `table` command can produce native Markdown tables (as piped tables) (but this capability is experimental, and I have been warned it may not be stable). This works with `dyntext` and `dyndoc`.

    Get the impression that producing a document with real tables is a hassle? This is a real hurdle to literate programming, once the source document becomes laden with formatting code rather than the code that is to the point of the document.
    Doug Hemken
    SSCC, Univ. of Wisc.-Madison

    Comment


    • #17
      Originally posted by Marc Kaulisch View Post
      First, of all happy new year to everybody.
      I hope it is not bad to hijack this thread but I have at the moment one issues that fit exactly into the threads' title

      German Rodriguez Thanks a lot for this very useful tool I start using. I have to say that I am still quite puzzled by the multitude of options within Stata to do literate programming and for someone who wants to start with it, it is really hard to get set up and to proper evaluate all options.
      -markstat- looks to be the best allround option to me at the moment. Nonetheless, I have at themoment one issue with the folllowing setup: Stata 15.1, markstat 2.1.1, pandoc 2.06, miktex 2.9.6515, sjlatex 1.2.2, tabout 3.0.3

      I like to use the docx option in order to be able to share the results to my colleagues without puzzling them too much.

      I used your tabout-example, added a tab/ to both -using tab/table34.html- and the - .include tab/table34.html-. This works when I am using the
      Code:
      markstat using simplescript, strict
      but not with the -docx- option.

      I am rather sure that the problem is caused in the .include argument.

      See this code - that is tweaked to store files in different folders.
      Code:
      Let us read the fuel efficiency data that is shipped with Stata
      ```s/
      qui sysuse auto, clear
      
      * qui fre foreign
      
      list make price headroom trunk weight length turn displacement gear_ratio if foreign==1
      ```
      To study how fuel efficiency depends on weight it is useful to
      transform the dependent variable from "miles per gallon" to
      "gallons per 100 miles"
      ```s
      gen gphm = 100/mpg
      ```
      We then obtain a more linear relationship
      ```s
      twoway scatter gphm weight || lfit gphm weight ///
      , ytitle(Gallons per Mile) legend(off)
      graph export tab/auto.png, width(500) replace
      ```
      ![Fuel Efficiency](tab/auto.png)
      
      That's all for now!
      
      
      ```s/
      quietly sysuse auto, clear
      quietly sum weight
      local meanwt = r(mean)
      quietly sum length
      local meanlen = r(mean)
      local obs = r(N)
      quietly tabout rep78 foreign using tab/table34.html, replace ///
      style(htm) font(italic) c(mean weight) f(0c) sum ///
      twidth(9) ///
      title(Table 34: Short report example) fn(auto.dta)
      ```
      
      The title of my short report
      ----------------------------
      
      This is an excerpt of the report to focus on the dynamic parts.
      And now we have an important result: __`s %3.2f `meanwt'`__ is
      the average weight of all vehicles. And a second important
      result: __`s %3.2f `meanlen'`__ is the average length.
      
      And now we have the first table.
      
      <center>
      
      .include tab/table34.html
      
      </center>
      Hi Marc,
      just wondering how to replicate your code to save the html file into different folder, any help please? as a new Markstat user, I am using the latest markstat code but German did not mention how to save output files into different folder.

      Comment

      Working...
      X