nick, thank you for your additional input. warning well-heeded. in view of vince's help, i have sticked to graph bar.
regards,
bw
> Subject: RE: st: producing graph bar help
> Date: Fri, 11 Jan 2008 19:16:34 +0000
> From: [email protected]
> To: [email protected]
>
> Thanks to Austin's and then Vince's clarification, here is an
> example of how to get -bargap()- to do something in -catplot-.
>
> . sysuse auto, clear
> . catplot bar foreign rep78, asyvars bargap(-30)
>
> bw: I pointed out earlier that -catplot, over()- is legal, because the
> extra options you can specify don't exclude -over()-, but it is _not_
> the intended use of -catplot- and in some circumstances it won't give
> the correct numerical results as far as the user is concerned. Vince
> repeated that comment. Here is the warning for a third time!
>
> Something like
>
> . catplot bar ind_methd year if ind_methd !="emerg", asyvars
>
> or
>
> . catplot bar year ind_methd if ind_methd !="emerg", asyvars
>
> is better practice.
>
> (-catplot- is on SSC.)
>
> Nick
> [email protected]
>
> b. water
>
> austin, thanks for your input and clarification.
>
> i tried (FWIW) to get travel.dta but there must an internal check
> mechanism either at statacorp or my end that blocked its use on my stata
> 8.2. btw you are right that the [G] i referred to was of stata 8. am not
> quite sure whether i can get travel.dta with stata 9 (a colleague has
> it) so that i can see what you are trying to illustrate. conceptually
> though i think i understand what you are trying to say wrt your example
> as well as the one on my stata 8 [G] p. 125 and gave me an idea to try.
>
> i tried this:
>
> obs year ind_methd rapid standard
> 4 2002 emerg
> 5 2002 emerg
> 14 2002 rapid rapid
> 1 2003 rapid rapid
> 8 2003 rapid rapid
> 3 2004 emerg
> 2 2005 standard standard
> 6 2005 rapid rapid
> 10 2005 rapid rapid
> 11 2005 standard standard
> 12 2005 standard standard
> 7 2006 rapid rapid
> 9 2006 standard standard
> 13 2006 rapid rapid
>
> then:
>
> . graph bar rapid standard, over(year)
> type mismatch
> r(109);
>
> . catplot bar rapid standard, over(year)
> no observations
> r(2000);
>
> BUT:
>
> if i fill the blanks with "." i.e. inserting . (dot or period) to the
> blank observations in both rapid and standard, i nearly get to where i
> wanted:
>
> obs year ind_methd rapid standard
> 4 2002 emerg . .
> 5 2002 emerg . .
> 14 2002 rapid rapid .
> 1 2003 rapid rapid .
> 8 2003 rapid rapid .
> 3 2004 emerg . .
> 2 2005 standard . standard
> 6 2005 rapid rapid .
> 10 2005 rapid rapid .
> 11 2005 standard . standard
> 12 2005 standard . standard
> 7 2006 rapid rapid .
> 9 2006 standard . standard
> 13 2006 rapid rapid .
>
>
> . graph bar rapid standard, over(year) -> still returns
> type mismatch
> r(109);
>
> however,
>
> . catplot bar rapid standard, over(year) bargap (-30)
>
> come tantalizingly close to what i wanted if only i can suppress the "."
> being displayed or used in the resulting graph.
>
> would therefore appreciate further advice/help if possible. otherwise i
> will settle for:
>
> . catplot bar ind_methd if ind_methd !="emerg", over(year) -> in this
> case -bargap- option would not be applicable as per austin's
> explanation.
>
> regards,
> bw
>
>> Date: Thu, 10 Jan 2008 10:27:20 -0500
>> From: [email protected]
>> To: [email protected]
>> Subject: Re: st: producing graph bar help
>>
>> Dear Nick and "b. water":
>> In his first post "b. water" announces Stata 8.2 and cites [G] p.125
>> (presumably the Stata 8 manual). The negative bargap option is
>> illustrated with
>>
>> webuse citytemp, clear
>> gr bar tempjuly tempjan, over(div) over(reg) nofill bargap(-30)
>>
>> in the Stata 10 manual [G] p.62, and it may not be clear, but the
>> bargap controls the relative plot position of tempjuly and tempjan,
>> not the positions of those two variables' bars with respect to over()
>> categories. Compare the following:
>>
>> webuse travel, clear
>> drop if choice==0
>> g x=1
>> replace party=3 if party>2
>> gr bar (count) x, over(mode) over(party) nofill bargap(-30)
>> separate x, by(mode)
>> gr bar (count) x1 (count) x2 (count) x3 (count) x4, over(party)
> bargap(-30)
>> collapse (count) x, by(mode party)
>> forv i=1/4 {
>> g `: label (mode) `i''=x if mode==`i'
>> }
>> gr bar air train bus car, over(party) bargap(-30)
>
> *
> * For searches and help try:
> * http://www.stata.com/support/faqs/res/findit.html
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
_________________________________________________________________
Watch “Cause Effect,” a show about real people making a real difference.
http://im.live.com/Messenger/IM/MTV/?source=text_watchcause
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/