Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: CATPLOT to compare

From   Lucie Vlach <[email protected]>
To   "[email protected]" <[email protected]>
Subject   RE: st: CATPLOT to compare
Date   Tue, 20 Mar 2012 11:39:46 -0600

Thank you very much, Nick!
The graphs look great! Really appreciate this.
Also, my apologies for not using  -catplot-  to indicate Stata syntax. Makes sense.
Thanks again!


From: [email protected] [[email protected]] On Behalf Of Nick Cox [[email protected]]
Sent: March 20, 2012 2:32 AM
To: [email protected]
Subject: Re: st: CATPLOT to compare

What I think you want can be done. Study this code and adapt to your

sysuse auto, clear
catplot rep78 foreign, percent(rep78)  blabel(bar)

local Np1 = _N + 1
expand 2
replace rep78 = 6 in `Np1'/L
gen extra = _n >= `Np1'
label def rep78 6 "Total"
label val rep78 rep78
catplot rep78 foreign, percent(rep78 extra) blabel(bar)

On some details:

1. The reference "Cox 2004" is ambiguous even with a guess as to who
and where. References should not have to be guessed: on Statalist we
ask for the same standards of referencing as you would want to
encounter in scholarly or scientific work.

2. The syntax you quote could only work with -catplot- 2.0.0 or later
(SSC 2010).

3. On the form -catplot- rather than CATPLOT please see


On Tue, Mar 20, 2012 at 3:03 AM, Lucie Vlach
<[email protected]> wrote:

> This seems like an easy task, but I cannot figure this out.
> I need to set up a bar graph sharing the same axis (if possible), showing a comparison of patient gender breakdown (in percent) for one doctor vs. whole clinic (in percent).
> Using Nick Cox’s catplot (Cox 2004), I am trying this:
> catplot doctor gender, percent(doctor)  blabel(bar)
> (doctor is float  %9.0g  and gender is  float  %9.0g)
> Stata IC 11.2 ver.
> But I cannot seem to be able to add the clinic overall gender percentage side by side with the individual doctor stats. For example, I need MALE showing 48.45% for doc, next to 38.07% for overall clinic and then FEMALE showing the rest respectively.
> Do I need to create an additional variable to make this work?

*   For searches and help try:

This message and any attached documents are only for the use of the intended recipient(s), are confidential and may contain privileged information. Any unauthorized review, use, retransmission, or other disclosure is strictly prohibited. If you have received this message in error, please notify the sender immediately, and then delete the original message. Thank you.

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index