Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Catplot problem
From
Nick Cox <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: Catplot problem
Date
Tue, 21 Jan 2014 13:40:13 +0000
The limitation here is not that of -catplot- (SSC) but of the -graph-
commands it calls, which allow only one variable in a -by()- option.
The help for -catplot- gives examples relevant to your needs.
catplot category sex agegroup
is a legal call, as is
catplot category sex, by(agegroup)
Nick
[email protected]
On 21 January 2014 13:34, Neophytos Stylianou
<[email protected]> wrote:
> Dear Statalist users,
>
> I have a problem with plotting a graph.
>
> I am using Stata 12.
>
> I have a categorical string variable which I want to graph as a bar chart based on each category percentage (below is the tablulation of the variable)
> CATEGORY Freq. Percent Cum.
> --------------------------------------------------------------------
> 01 Accidental: recreation | 25,096 35.72 35.72
> 02 Accidental: work related | 8,602 12.24 47.96
> 03 Accidental: not work related | 15,459 22.00 69.97
> 04 Accidental: unspecified | 14,815 21.09 91.05
> 05 Assault | 1,244 1.77 92.82
> 06 Self inflicted | 1,616 2.30 95.12
> 07 Suicidal | 195 0.28 95.40
> 08 NAI of child | 213 0.30 95.70
> 09 Arson | 119 0.17 95.87
> 98 other | 1,486 2.12 97.99
> 99 unknown | 1,413 2.01 100.00
> --------------------------------+-----------------------------------
> Total | 70,258 100.00
>
> Unfortunately Stata won't do it with its graphics options so I used -catplot- which is a user written program downloaded from SSC.
>
> I use the following command and it works perfectly
>
> catplot category, percent
>
> What I want is to have it BY 2 other variables (sex, agegroup)
>
> So I am trying to use the command:
>
> catplot category, percent by(sex agegroup )
>
> But it says too many variables specified r(103).
>
> It looks like catplot is able to plot a variable restricted to only one by variable.
>
> Is there another way of plotting the graph I want?
>
> Thanks a lot.
> Neo
>
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/faqs/resources/statalist-faq/
> * http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/