Announcement

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

  • Changing variable names on a forest plot STATA 15.1

    Ok so i have ran a mata analysis odds ratio and created a forest plot,i have what i need on the graph but i just need to change the study names. for example they show up as 1,2,3,4,5 . How can i change the numbers to medical , dental, specialty etc.
    i have looked everywhere but the examples i keep seeing are on STATA 16 so its not working for me
    Any help would be greatly appreciated

    . metan lnor lnlci lnuci, eform effect (OR)type

    Study | ES [95% Conf. Interval] % Weight
    ---------------------+---------------------------------------------------
    1 | 0.510 0.440 0.590 30.63
    2 | 0.710 0.610 0.810 32.77
    3 | 4.020 3.100 5.200 9.85
    4 | 1.920 1.560 2.340 16.03
    5 | 1.720 1.340 2.200 10.72
    ---------------------+---------------------------------------------------
    I-V pooled ES | 0.981 0.905 1.064 100.00
    ---------------------+---------------------------------------------------


    this is the code i used

    ssc install metan
    set obs 5
    gen or=0
    gen lci=0
    gen uci=0
    edit
    replace or=0.51 in 1/1
    replace or=0.71 in 2/2
    replace or=4.02 in 3/3
    replace or=1.92 in 4/4
    replace or=1.72 in 5/5
    replace lci=0.44 in 1/1
    replace lci=0.61 in 2/2
    replace lci=3.1 in 3/3
    replace lci=1.56 in 4/4
    replace lci=1.34 in 5/5
    replace uci=0.59 in 1/1
    replace uci=0.81 in 2/2
    replace uci=5.2 in 3/3
    replace uci=2.34 in 4/4
    replace uci=2.2 in 5/5
    gen lnor= ln(or)
    gen lnlci= ln(lci)
    gen lnuci= ln(uci)
    metan lnor lnlci lnuci, eform effect (OR)

  • #2
    forgot to attach this to post
    Click image for larger version

Name:	forest plot help.PNG
Views:	1
Size:	35.6 KB
ID:	1572998

    Click image for larger version

Name:	data forest plot.PNG
Views:	1
Size:	46.2 KB
ID:	1572999

    Comment


    • #3
      You need to use the label(namevar=studyname) option. Create a string variable with the study name, or assign value labels to a numeric variable.

      For details on the use of metan, as with all Stata commands, see the output of help metan which describes the use of the metan command.
      Last edited by William Lisowski; 16 Sep 2020, 07:23.

      Comment


      • #4
        Originally posted by William Lisowski View Post
        You need to use the label(namevar=studyname) option. Create a string variable with the study name, or assign value labels to a numeric variable.

        For details on the use of metan, as with all Stata commands, see the output of help metan which describes the use of the metan command.
        Thank You for your help! I got exactly what i needed!

        Comment

        Working...
        X