Announcement

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

  • How I add `stata.sty' to Latex (for taking a .do file to latex)

    Hello everyone,
    I have created the following example in a .do file and saved the .do file as "example.do". I want to take the lines of this do. file to latex.

    Code:
    texdoc init "C:\example.tex", replace
    /*tex
    \documentclass{article}
    \usepackage{stata}
    \begin{document}
    \section*{Exercise 1}
    Open the 1978 Automobile Data and summarize the variables.
    tex*/
    
    texdoc stlog
    sysuse auto
    summarize
    texdoc stlog close
    /*tex
    \section*{Exercise 2}
    Run a regression of price on milage and weight.
    tex*/
    texdoc stlog
    regress price mpg weight
    texdoc stlog close
    /*tex
    \end{document}
    tex*/
    Then I ran the following command:
    Code:
    texdoc do "C:\example", replace

    It created three text files, namely :
    Code:
    example
    and
    Code:
    example_1.log
    and
    Code:
    example_2.log
    .

    Then I used latex to open text file
    Code:
    example
    . When I wanted to create .pdf, I got the following message from latex:
    Code:
    ! LaTeX Error: File `stata.sty' not found.Type X to quit or <RETURN> to proceed,or enter new name. (Default extension: sty)Enter file name:! Emergency stop.<read > \begin
    Please let me know how I can add
    Code:
    `stata.sty'
    to latex.

    Thanks,
    Hossein

  • #2
    You can download stata.sty from the Stata Journal and save it in your current working directory using the command
    Code:
    copy http://www.stata-journal.com/production/sjlatex/stata.sty stata.sty
    You may want to take a look at markstat from SSC, which lets you write the script in Markdown and generates LaTeX, also using stata.sty..

    Comment


    • #3
      Thanks

      Comment

      Working...
      X