Announcement

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

  • Outreg2 for summary statistics

    Hi all,

    I am trying to figure out the way to use outreg2 to export the summary statistics of my data to word.

    I used the command,
    Code:
     reg p_csmoker pp cigtax Sex age_gr bage_gr socialc hqual college dnnow year nationality
    outreg2 using myfile.doc, sum replace
    but STATA gives me "file myfile.txt could not be opened
    r(603)
    ;"

    I did not have any trouble for getting regression tables but I just cannot figure this out...

    Could anyone help me out?

    Thanks in advance!

  • #2
    That error message usually means your current Stata working directory is one to which you do not have write access. Type the command pwd in the Command window to check that you haven't accidentally changed your working directory to somewhere you don't intend to be.

    Comment


    • #3
      I just run the same code that given me the regression table but it no longer works as well...

      I typed in the command pwd but frankly I do not have a clue what this means or what should I do with it.

      Could you explain what should I do to fix outreg2 ?

      Comment


      • #4
        I just figured out the problem and here is how I did it (for future references)

        1. Navigate to the Stata installation directory on your local drive [most likely 'Program Files (x86)' if you're on a 64 bit windows operating system.)

        2. Right click the stata directory / properties / security /

        3. Modify the Folder permissions to grant 'full control' to the username you're currently log on with.
        (click on the username you logged on with/click edit/ check full control under the permissions / click apply / ok )

        4. Done!

        full credit to Jonathan Ntoni who kindly gave us what I needed.
        original website is here; http://statalist.1588530.n2.nabble.c...td3593265.html

        Thanks William for trying to help out!

        Comment


        • #5
          I typed in the command pwd but frankly I do not have a clue what this means or what should I do with it.
          For advice on what the output of pwd means, run the following commands and copy the commands and their output from Stata's Results window and paste it into your next post using code delimiters [CODE] and [/CODE].
          Code:
          pwd
          dir

          Comment


          • #6
            Fuga Iwama Thank you for following up.

            For others who wonder why that is a necessity, I expect it is because outreg2 installs outreg2_pref.ado into the same directory as outreg2.ado and updates outreg2_pref.ado each time Stata is run. I suspect that the failure to be able to update outreg2_pref.ado caused the sub-program that writes to myfile.dta to fail, and its failure generated the misleading error message. But that's a guess. I have no guess why the ability to update outreg2_pref.ado would have changed on the system under discussion.

            A more security-conscious workaround to this problem (for future reference) would be to run the command which outreg2 and then navigate to the directory listed in the output of the command and modify the permissions of just that directory.

            I think that versions of Stata that run on modern multi-user operating systems (linux and macOS) do not have this problem, because each user on the system has their own PLUS directory installed in a location within their home directory and thus will have the required permissions to update files. By contrast, what I understand of Windows from examples in Stata's documentation and from the successful resolution to this problem is that the PLUS directory may be installed in a shared portion of the filesystem, with all the problems that can cause.

            Comment

            Working...
            X