• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to secondary sidebar

Dr Andy Teh

Healthcare Quality Consultant

  • Home
  • Archive
  • About
  • Contact
You are here: Home / Stata / How to Install Meta-Analysis Commands in Stata
post

How to Install Meta-Analysis Commands in Stata

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

March 1, 2012 21 Comments

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 did not come with Stata 10 by default; users of this and a number of subsequent versions of Stata have to download and install these user-written meta-analysis commands themselves.

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

I essentially 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 some small 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 commands associated with Stata Technical Bulletins (stb). I simply followed the instructions found in Sterne et al.’s guide:

Stata commands metan funnel metacum metabias metareg meta

I found that, in my installation of Stata, 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 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 was unable to 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, simply 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! :smile:

Filed under: Stata  Tagged with: meta-analysis, metabias, metacum, metafunnel, metan, stata, stata commands, user-written commands

Reader Interactions

Comments

  1. I says

    October 31, 2012 at 1:17 AM

    Thank you so much. My version of STATA stubbornly refused the commands I was entering!

    Reply
    • Andy Teh says

      October 31, 2012 at 7:29 AM

      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. 🙂

      Reply
      • JosephY says

        August 2, 2015 at 1:59 PM

        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.

        Reply
      • Eric Ikonne says

        February 24, 2017 at 12:32 AM

        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.

        Reply
  2. shafi says

    February 28, 2013 at 7:52 PM

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

    Reply
    • Andy Teh says

      March 4, 2013 at 12:22 AM

      @Dr Shafi – The information you’re seeking is found in Step 2 above. For example, to install metacum, first click on the “Help” tab within Stata, followed by “SJ and User-written Programs”, and then “STB”. Click on stb42, and then sbe22. You should be done!

      Reply
  3. lumen says

    November 29, 2013 at 3:53 PM

    Hello,
    Thanks for the info, though Im new to stata, I have always done analysis in SPSS, but recently need to perform a meta analysis. Any info to guide me through this especially being new to all the commands?
    thanks

    Reply
    • Andy Teh says

      December 31, 2013 at 10:02 PM

      @lumen – I’m familiar with Stata but not SPSS. I’ve found short courses in Stata quite useful because the learning is guided and you are able to get feedback – see https://www.stata.com/learn/ . There are books on using Stata but I have rarely found them of much help.

      Reply
  4. Kyoungjune says

    December 31, 2013 at 10:35 PM

    Hello,
    I have followed as your recommendation.
    However, I can still see the sign of “unrecognized command”.
    What might be the problem?

    Reply
    • Andy Teh says

      December 31, 2013 at 10:38 PM

      @Kyoungjune – It could be related to a later version of Stata – the instructions above apply to Stata 10.

      Reply
  5. paolo says

    June 26, 2014 at 12:26 PM

    great !! thanks a lot

    Reply
  6. Ulrich says

    August 8, 2014 at 6:01 PM

    Dear Andy Teh,

    I have followed the steps as you mentioned. I have the metan 1.0 version (*! version 1.0 5May98 STB-44 sbe24). When I try to write ‘scc install metaaggr, all replace’ command, my STATA says:
    “scc install metaaggr, all replace
    unrecognized command: scc
    r(199);”
    I have a MacBook, but the STATA version i fully compatible. Do you know why the command does not work?

    Reply
    • Andy Teh says

      September 22, 2014 at 12:34 PM

      @Ulrich – I’m not sure if the problem is due to your version of Stata (I used version 10) or the fact you’re on a Mac operating system (I use Linux), or something else. The steps above have generally been replicable by those with the same setup as mine.

      Reply
  7. K.Asmare says

    June 4, 2015 at 3:03 PM

    Thanks a lot for the advice! I followed the steps and updated the stata 12 I am using. However, in meta regression analysis, the output doesn’t give the following results:-
    -REML estimate of between study variance
    -The between study variance explained (Adj-R squared)
    -Joint test for all covariates.

    Reply
  8. Lima says

    November 8, 2015 at 10:52 PM

    Thanks a lot for this very helpful advice! Worked perfectly for me!

    Reply
  9. R says

    June 9, 2016 at 5:37 PM

    You are a HERO! This needs to be repeated- You sir, are a HERO! Thanks a ton! 😀

    Reply
  10. Ching SM says

    September 3, 2016 at 5:59 PM

    Andy Teh,
    You are super.
    How to run metaregression?

    Reply
  11. Fabiano Timbó Barbosa says

    September 7, 2016 at 7:25 AM

    Dr Andy Teh

    I need to run metaregression. I tried sometimes, but I have no success.

    I believe that I do not know how to insert data in STATA. Could you send me one picture or a guide showing how I can do this?

    Thank you

    Reply
  12. Nicole says

    November 3, 2016 at 10:57 AM

    I am so so thankful for your great summary. You saved my life 🙂

    Reply
  13. Diep says

    March 3, 2017 at 4:21 PM

    Hi, I am using stata from server of the UNSW. I need to run stata on my computer but it seems it not allow me to install. Could you please show me the way to install it? I found last time that I need to change the directory but I forgot. Thanks for your help!

    Reply
    • Andy Teh says

      March 10, 2017 at 10:00 PM

      @Diep – I’m sorry I don’t provide support for the installation of Stata. I suggest you reach out to your university’s IT Department for help.

      Reply

Leave a Reply to Lima Cancel reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Copyright © 2021 Dr Andy Teh