Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Sampling weights with twoway line graph


From   "Eva Poen" <eva.poen@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Sampling weights with twoway line graph
Date   Thu, 25 Sep 2008 09:07:05 +0100

Mike,


-help collapse- shows that pweights are allowed with -collapse-. Therefore,

collapse drugA drugB drugC [pweight=pwt], by(year)

followed by a -twoway line- ought to give you what you need.

Eva

2008/9/25 Mike Schmitt <mrschmitt@gmail.com>:
> Hi all,
>
> Using the Bar Chart, I can use sample weights and graph the mean of
> each of my variables to get the plot of interest.  I was wondering if
> I could get a line graph showing same data (ie, lines instead of
> bars).  Using Stata 10.1, it seems that there is no way to enter in
> sample weights for a basic twoway line graph, unless I'm over looking
> something.
>
> My current bar chart syntax is:
> graph bar (mean) drugA (mean) drugB (mean) drugC [pweight = pwt], over(year)
>
> And the bar chart is spot on, like it should be, however I'm dumb
> founded of how to coerce stata into giving me the same graph only with
> lines.  Thanks to previous help from this listserv, I know that I can
> collapse the data to get Stata to get a line graph of means, however
> I'm unsure of how that can be done while maintaining the weighting
> procedure and hence I'm a tad apprehensive to do that.  If I could
> just swap the bars I'd be happy.  Any thoughts?  Thanks,
>
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index