Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: ''option ysi not allowed'' when using metan command
From
Amal Khanolkar <[email protected]>
To
"[email protected]" <[email protected]>
Subject
st: ''option ysi not allowed'' when using metan command
Date
Wed, 10 Jul 2013 13:25:51 +0000
Hi everyone,
I'm getting the following error message when I'm trying to use the metan command to generate a forest plot. The code I use is below:
*Generate dataset with RR, corresponding CIs, and grouping variables; group (5 nos) and outcome (3 no):
input id rr lci uci group outcome
1 1.12 0.78 1.62 2 1
2 0.96 0.83 1.30 2 2
3 0.96 0.85 1.09 2 3
4 0.84 0.65 1.07 3 1
5 0.98 0.90 1.07 3 2
6 0.95 0.88 1.02 3 3
7 1.11 0.69 1.80 4 1
8 1.08 0.90 1.30 4 2
9 0.85 0.73 0.97 4 3
10 1.76 1.24 2.50 5 1
11 1.15 0.98 1.34 5 2
12 0.86 0.75 0.99 5 3
end
*Create labels for the group variable:
gen str immigrant_group=""
replace immigrant_group ="Western europe and North America" if group==2
replace immigrant_group ="Finland" if group==3
replace immigrant_group ="Eastern Europe" if group==4
replace immigrant_group ="Poland" if group==4
*Create labels for the Outcome variable:
gen str Outcome_type=""
replace Outcome_type ="Early preterm" if outcome==1
replace Outcome_type ="Late preterm" if outcome==2
replace Outcome_type ="Postterm" if outcome==3
*Create a sorter variable to instruct stata on the right order:
***defining a sorter variable to bring the graph results into the intended order
gen sorter =.
replace sorter =1 if immigrant_group=="Western europe and North America" & outcome==1
replace sorter =2 if immigrant_group=="Western europe and North America" & outcome==2
replace sorter =3 if immigrant_group=="Western europe and North America" & outcome==3
replace sorter =4 if immigrant_group=="Finland" & outcome==1
replace sorter =5 if immigrant_group=="Finland" & outcome==2
replace sorter =6 if immigrant_group=="Finland" & outcome==3
replace sorter =7 if immigrant_group=="Eastern Europe" & outcome==1
replace sorter =8 if immigrant_group=="Eastern Europe" & outcome==2
replace sorter =9 if immigrant_group=="Eastern Europe" & outcome==3
replace sorter =10 if immigrant_group=="Poland" & outcome==1
replace sorter =11 if immigrant_group=="Poland" & outcome==2
replace sorter =12 if immigrant_group=="Poland" & outcome==3
*sorting data into the correct order
sort sorter immigrant_group outcome
*Generate the forestplot:
#delimit ;
metan rr lci uci,
by(immigrant_group) nosubgroup
xlabel( 0.4, 0.8, 1, 1.2, 1.4, 1.8, 2.2, 2.6, 3.0)
xtick(0.4, 0.8, 1, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 3.0)
effect(Risk ratio)
force nowt nooverall nobox
label(namevar=immigrant_group)
sortby(sorter immigrant_group group)
lcols(immigrant_group)
title("Adjusted relative risks for preterm and postterm birth by immigrant groups in Sweden", size(small) color(black))
pointopt( msymbol(T) mcolor(black) msize(medsmall))
ciopt( lcolor(gs8) lwidth(medium) )
favours(Pretermbirth # Postterm birth)
graphregion(fcolor(white) lcolor(gs15) ifcolor(white) ilcolor(white)) ;
#delimit cr
The output that I get:
Study | ES [95% Conf. Interval]
---------------------+---------------------------------------------------
Western europe and N
Western europe and N | 1.120 0.780 1.620
Western europe and N | 0.960 0.830 1.300
Western europe and N | 0.960 0.850 1.090
---------------------+---------------------------------------------------
Finland
Finland | 0.840 0.650 1.070
Finland | 0.980 0.900 1.070
Finland | 0.950 0.880 1.020
---------------------+---------------------------------------------------
Eastern Europe
Eastern Europe | 1.110 0.690 1.800
Eastern Europe | 1.080 0.900 1.300
Eastern Europe | 0.850 0.730 0.970
---------------------+---------------------------------------------------
Poland
Poland | 1.760 1.240 2.500
Poland | 1.150 0.980 1.340
Poland | 0.860 0.750 0.990
option ysi not allowed
r(198);
end of do-file
r(198);
Any ideas as to what I'm doing wring?
Thanks!
/Amal
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/