st: graph command: xline() with by() option

 From [email protected] To [email protected] Subject st: graph command: xline() with by() option Date Wed, 20 Aug 2008 01:17:27 +0200 (CEST)

```Hello, I would like to draw a histogram with two vertical lines showing
upper and lower estimates of a statistic for two (or more) groups using
the graph command of Stata 7.0.

This is a snippet of the
example dataset:
grp������
stat�����������
lower_es�����������
upper_es
1���������
91�����������
43.45387�����������
60.79625
1���������
60�����������
43.45387�����������
60.79625
1���������
87�����������
43.45387�����������
60.79625
1���������
52�����������
43.45387�����������
60.79625
[..removed..]
2���������
100�����������
79.70421�����������
124.2349
2���������
60�����������
79.70421�����������
124.2349
2���������
77�����������
79.70421�����������
124.2349
2���������
125�����������
79.70421�����������
124.2349
[..removed..]

post at http://www.stata.com/statalist/archive/2003-08/msg00282.html about
a similar topic.

Nevertheless, I can&rsquo;t figure out how to
draw upper and lower estimates with &lsquo;xline()&rsquo; option when the
&lsquo;graph&rsquo; command is combined with the &lsquo;by&rsquo; option
like that:

��� graph stat, by(grp)
xline(`=lower_es[_n]' `= upper_es[_n]')

In fact, the graph
command always draw vertical lines in the same position in all the
histograms combined with the by option (I suppose it always draws
lower_es[1] and upper_es[1]).

I considered the possibility to
create histograms using the &lsquo;by&rsquo; clausole like that:

��� by grp: graph stat, xline(`=lb[_n]' `=ub[_n]') xlab(0
20 to 140)

but I obtained the the same previous result.

Anyone can suggest me a solution ?

Thanks