Announcement

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

  • Markstat and PDF: Change the width of stata output

    Hi everyone,

    I am using markstat (German Rodriguez) to make a pdf document. However, one of the stata results appeared as the picture below.
    Does anyone know how to extend the width of the stata results? I tried modifying the stata.sty document but I could not find the line in which the width is determined.

    Thanks!


    Rocio


    Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	66.5 KB
ID:	1517710

    Last edited by Rocio Valdebenito; 24 Sep 2019, 08:59.

  • #2
    Hi Rocio Valdebenito. markstat obeys Stata's linesize setting. Try something like set linesize 96. You can check the current setting using di c(linesize)

    Comment


    • #3
      Hi German Rodriguez . Thanks for your answer. Unfortunately, I tried it but it did not work.

      Here (in bold) is my .stmd file:

      ---
      title: Example
      author: Rocío Valdebenito
      geometry: margin=3 cm
      date: October 5, 2019
      ---
      ```s/
      clear all
      quietly: cd "C:\Users\riv2\Dropbox\00UIUC\2019-Fall\ACE 531-Impact Evaluation\Problem Sets\Example-Stata-Width"
      quietly: use evaluation
      set linesize 96
      ```
      Here is an example

      ```s
      reg health_expenditures enrolled age_hh age_sp educ_hh hospital_distance poverty_index
      ```



      Attached is the resulting pdf. After typing in the command: markstat using Example, pdf


      Do you have any idea about what is happening?
      Thanks,

      Rocio
      Attached Files

      Comment


      • #4
        Hi Rocio Valdebenito. I see that my earlier reply was not correct. To translate a log -markstat- uses Stata's -translate- and sets the width to the current linesize. However, when the target is LaTeX it uses Stata's -log texman- with its defaults, which I believe include a linesize of 80. This means everything will work fine as long as the output is no wider than 80 character. Fortunately this is usually the case.

        In the PDF file you uploaded, the regression output is wider than 80 characters because the name of the dependent variable is very long. Interestingly, in my system longer names are abbreviated to 12 characters, but in yours they are shortened to 17 characters, which makes the total output wider than 80. A quick and dirty fix would be to change the name of your dependent variable to something shorter.

        This may not work for the example at #1, where the output of the command itself seems to be wider than 80 characters. I've been looking at the source code of -sjlog- and I think it is possible to change the linesize used by -log texman-. I will look into incorporating that in -markstat-. It would help testing if you could upload or email me one of your wide smcl logs. Bear in mind, however, that wider output may not work well in the -sjlog- environment used to wrap Stata output.

        Comment


        • #5
          Hello German Rodriguez Thanks for your reply.

          Actually, I tried renaming variables and that usually works.
          However, I have another example in which the output is too wide even after doing renames.

          Here is my code and attached are the resulting PDF and the .smcl file.


          ---
          title: Example 2
          author: Rocío Valdebenito
          geometry: margin=2.5 cm
          date: October 7, 2019

          ---
          ```s/
          clear all
          quietly: cd "C:\Users\riv2\Dropbox\00UIUC\2019-Fall\ACE 531-Impact Evaluation\Problem Sets\Example-Stata-Width"
          quietly: use evaluation-wide
          eststo clear
          ```

          Example with long width Stata output. In this example, even renaming some variables. The output is still too wide and it is not a good fit with the width.


          ```s
          rename hospital_distance hosp_d
          rename poverty_index poverty_i
          rename health_expenditures1 h_exp1
          psmatch2 enrolled age_hh0 educ_hh0 educ_sp0 poverty_i female_hh ///
          indigenous dirtfloor hosp_d, out(h_exp1)
          ```




          P.S: The data can be found at https://www.worldbank.org/en/program...on-in-practice. The data that I used for this example was obtained after doing the following reshape:
          reshape wide health_expenditures age_hh age_sp educ_hh educ_sp hospital, i(household_identifier) j(round)



          Thanks!
          Attached Files

          Comment


          • #6
            Thanks Rocio Valdebenito for uploading the smcl log. I translated it to LaTeX setting the line size to 90 and that worked. Of course LaTeX complains about overfull boxes and, as you can see from the attached file, the output goes out into the margin. I suppose that is still better than wrapped lines, so I'll be testing an update to -markstat- to use the current linesize setting for LaTeX, as it does with other formats.
            Attached Files

            Comment


            • #7
              Thanks German Rodriguez.
              Thanks for solving it. But I don't know exactly how you did this.
              Can you please give me more information about how can I translate the scml file into LaTeX? I would like to apply it to other documents in which I had the same problem
              Thank you again,

              Rocio

              Comment


              • #8
                That was just a proof of concept, to make sure log texman works with wider output. I have now incorporated the change in markstat and submitted the update to SSC. I'll post here when it is up, so you can rerun the other documents.

                Comment


                • #9
                  Hi Rocio Valdebenito. Thanks to Kit Baum the updated markstat is now available from SSC. If you set linesize 90 or so your example 2 will run fine.

                  Comment


                  • #10
                    Thank you very much German Rodriguez and Kit Baum.
                    It works perfectly!

                    Rocio

                    Comment

                    Working...
                    X