Announcement

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

  • Working with dyndoc

    I'm giving dyndoc a whirl and am running into issues. This code:
    Code:
    <<dd_do: quietly>>
    use ..\wls_usethis, clear
    <</dd_do>>
    <<dd_do>>
    sum occ_occed_max if rtype == "g" // graduates
    sum occ_occed_max if rtype == "s" & female == 0 // siblings
    sum occ_occinc_max if rtype == "g" // graduates
    sum occ_occinc_max if rtype == "s" & ed_lt12 != 0 // siblings
    sum occ_warhaus_max if rtype == "g" // graduates
    sum occ_warhaus_max if rtype == "s" & ed_lt12 != 0 // siblings
    <</dd_do>>
    Looks fine in terms of the output it produces in Stata, but the HTML output looks like the below when I open it in a browser (either explorer or chrome -- sorry for the ginormous size).

    Any thoughts? I'm not sure if this is suggestive of a broader bugginess that I'm going to run into, such that it might be better to wait than invest time in using to create documents presently.

    Click image for larger version

Name:	image_8828.png
Views:	1
Size:	309.5 KB
ID:	1410611


    --Jeremy




  • #2
    OK, I figured this out. You need to put ~~~~ before any <<dd_do>> block.

    Comment


    • #3
      As it turns out, you could also use either three tildes or three backticks as "code fences" (code delimiters). As you have noticed, these are purely style elements, and have nothing to do with parsing and executing Stata code.

      Better documentation of the markdown syntax used here might be:
      http://commonmark.org/help/
      http://spec.commonmark.org/0.28/

      Flexmark appears to be a powerful java library, and I wish more of it's functionality were exposed within Stata.
      Doug Hemken
      SSCC, Univ. of Wisc.-Madison

      Comment


      • #4
        Jeremy: you may want to look at markstat, available from SSC, which uses a simpler syntax to combine Markdown and Stata. The script is very readable and produces clean HTML. If you have LaTeX installed it can also produce PDF from the same script. The forum announcement is here and lots more info, including reference to the Stata Journal article introducing the command, at http://data.princeton.edu/stata/markdown

        Comment


        • #5
          Just a note:

          The width of your output/results text depends on the current linesize, which defaults to whatever is set for your current Stata session. In other words, you can convert the very same markdown document and get somewhat different results from different Stata sessions.

          No big deal for causal use, but if you are a stickler for detail, you may want to set linesize in an early <<dd_do>> block as a matter of habit (or use cscript).
          Doug Hemken
          SSCC, Univ. of Wisc.-Madison

          Comment


          • #6
            This is likely true of markstat and markdoc as well.

            Note also that if you do reset the linesize, it will persist back in the session where you issued the dyndoc/dyntext command.
            Doug Hemken
            SSCC, Univ. of Wisc.-Madison

            Comment

            Working...
            X