How to Install Meta-Analysis Commands in Stata

User-written meta-analysis commands (e.g., metan, metafunnel) must be downloaded and installed to perform meta-analysis in Stata.

Stata, a statistical software package by StataCorp, boasts an impressive suite of meta-analysis features. metan is the Stata module for fixed and random effects meta-analysis. metafunnel “plots funnel plots: graphical displays used to examine whether the results of a meta-analysis may have been affected by publication or other types of bias.” These two commands do not come with Stata 10 by default; users of this and several subsequent versions of Stata have to download and install these user-written meta-analysis commands themselves.

Below, I summarize how I installed metan and metafunnel in Stata 10. Depending on your version of Stata, YMMV.

I used the guide available in Chapter 18 of Systematic Reviews in Health Care: Meta-Analysis in Context, 2nd Edition “Meta-analysis in Stata,” by Sterne, Bradburn, and Egger, but with minor changes and additions, which I will outline below.

Step 1: Update your installation of Stata.

. update all

Step 2: Install the user-written commands, e.g. metan, metafunnel.

I installed the commands from within Stata, i.e.

Help → SJ and User-written Programs → STB

You will see a list of Stata Technical Bulletins (stb) commands. I followed the instructions found in Sterne et al.’s guide:

Stata commands metan funnel metacum metabias metareg meta

In my Stata installation, I found the packages had an underscore, e.g., sbe24_1, instead of a decimal point, e.g., sbe24.1.

In addition, I installed the following metafunnel command within Stata by typing:

. ssc install metafunnel

This command enables the creation of funnel plots with pseudo 95% confidence limits.

Step 3: Check for updated versions or new commands:

. update all
. search metan

Having performed the steps above, I could not use the metan command to perform a fixed and random-effects meta-analysis. The problem was an old version of metan, specifically metan 1.0! You can check your version of metan:

. which metan

To update the version of metan, enter the following command on the Stata command line:

. ssc install metaaggr, all replace

Completing this last step enabled me to conduct a fixed and random-effects meta-analysis.

The steps above should not take longer than 5 minutes. Enjoy!

21 comments add your comment

    • Glad the article helped to solve your problem with Stata. Sometimes, it takes some trial and error and/or Googling. If those things don’t work, I’ll be happy to assist. 🙂

      • Hi,
        I would like to thank you too. Thank you so much. My Stata also consistently rejected commands. The whole thing was to click “update all.” I have never thought the answer would be this easy.

      • Hello,

        I tried all of these things, and STATA wont recognize the command. r199 keeps coming up and I have updated everything and added all the new commands.

  1. Hello, I have installed the metan commands but how can i install follwoing commands
    metacum
    metainf
    metabias
    metareg
    please guide me
    Dr Shafi