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   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: CATPLOT to compare
Date   Tue, 20 Mar 2012 08:32:48 +0000

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:

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