Economics should be open

January 8, 2009

file “outreg2_prf.ado” not found

Filed under: coding, Open Source, Stata — howardchong @ 1:03 am

So, I get the above stata error when using outreg2 which I install with “ssc install outreg2”.

This articles tells you (1) what I did to trigger the error message and (2) what steps I took to fix it.

UPDATE JUL2009: A good comment below suggests (from stata staff) that  it has to do with disk writes. So, that’s the best answer to date.

It comes up at odd times. I’m running a loop with 600 sets of 3 regressions and am outregging to each separately. That is:

forvalues i=1/600 {
  regress XXX
  outreg2 using file1
  regress XXX
  outreg2 using file2
  regress XXX
  outreg2 using file3

And so it’s appending to the existing file each time.

I also had two variants. That is, I used:
quietly: outreg2 using file2, brackets
the quietly surpresses output and the brackets replaces the parentheses (that excel thinks are negative numbers) with brackets.

I then went and looked for the outreg2_prf.ado file. I checked in C:\ado\plus\o where the other outreg2 files are. I couldn’t find this file. So I downloaded it and saved it to the directory. I got the file from

Well, I fixed the missing .ado error, but my code still breaks at a random place and says that one of my outreg2 output files is missing. Since it doesn’t break the same place each time, I’m a bit confused as to what’s going on. Still troubleshooting by trying to run it from a different directory and then on a different computer.

ACK! Giving me the error again! I am trying ssc uninstall outreg2 and then ssc install outreg2.

Also trying restarts of Stata. I’m running Stata 10 SE by the way.

Ok. Not sure what I did, but it appears that I fixed it. I did three things:
1) I changed my regression directory. I had previously had the working directory under some really long (more than 100 characters) pathname, so I put it into c:\data.
2) I put my do file in the same directory
3) I closed STATA, opened, and ran ssc uninstall outreg2 and then ssc install outreg2 as the first thing in my new session.

Oddly, neither 1 alone nor (1+2) fixed the problem.

Bottom line: I don’t think the bug is directly in outreg2. I think it is related to long pathnames.

Oddly enough, the code *did* work with this path:
C:\Documents and Settings\Howard\My Documents\UCEI\Bushnell EU Carbon\stage2\Project Management10 – panel of stock prices vs market model plus price of carbon
but not with this path:
C:\Documents and Settings\Howard\My Documents\UCEI\Bushnell EU Carbon\stage2\Project Management18 – add oil price\regress

Hope nobody has to deal with this (including myself) and that my troubleshooting steps are helpful to someone someday (including myself)



  1. UPDATE I no longer get this error code. It was very sporadic. I’m now running a smaller data set, and I think that makes a big difference.

    Comment by howardchong — April 7, 2009 @ 9:09 pm

    • Hi Howard,
      I was having the same issues you were having but didn’t have as much luck solving the problem. I wrote to STATA support and this is their solution:

      Dear Alex,

      It the hard drive is too slow to keep up with the data that Stata is
      generating. That is why this is happening at different times for different
      runs. The hard drive is only keeping up with Stata to a certain point.

      To correct this you can place a -sleep- command in your loop to to make sure
      your files are finished writing before Stata tries to move on. Windows will
      only allow Stata to access one file at a time. See -help sleep- for more
      information on the -sleep- command.

      Hope it helps you or anyone else who might have this problem again.

      Comment by Alex — July 24, 2009 @ 6:08 pm

  2. I am still experiencing this outreg2 error when using our Unix system. I found that all seems to work fine if I write “cap noisily outreg2” instead of outreg2.


    Comment by Ioana Marinescu — January 10, 2011 @ 10:35 pm

  3. I had the same problem with outreg2 on my mac. I followed the steps given by Howard to shorten the filepath. Amazingly the problem is solved. Thanks.


    Comment by Jackson — October 8, 2014 @ 7:58 pm

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at

%d bloggers like this: