Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | "Leung, Adelaine K.W." <Adelaine_Leung@hms.harvard.edu> |
To | "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |
Subject | Re: st: RE: problem using catplot to graph vertical bars |
Date | Tue, 26 Oct 2010 12:27:47 -0400 |
Thanks Nick! I'm new to stata so I was relying on google a lot which pointed me to the old command options. As you said, the help file was much better. Thanks for you help. Adelaine On Oct 26, 2010, at 8:11 AM, Nick Cox wrote: > Adelaine is using -catplot- 2.0.0 from SSC. As the FAQ advises > > http://www.stata.com/support/faqs/res/statalist.html#stata > > "Say what command(s) you are using. If they are not part of official Stata, say where they come from: the STB/SJ, SSC, or other archives." > > This is so that people who might answer the question have a much clearer notion of what is being asked -- and so that people who might not answer the question have a chance to learn about something -- and so that people who ask the question get good answers faster. > > There are three ways of understanding what is going on here. > > 1. Logic. If -catplot- understands that -group-, the first thing named, is a variable, then by the same logic -catplot- expects that -bar-, the first thing named, should be a variable. But Adelaine has no such variable, which is precisely why -catplot- complains and issues an error message. > > 2. Reading the help file. This explains that -recast(bar)- is the option that Adelaine is seeking. Reading the help is often a good idea. Perhaps Adelaine is guessing at appropriate syntax by analogy with -graph bar-, but -catplot- 2.0.0, although calling -graph {bar|hbar|dot}, uses its own syntax. > > 3. Historical research. Perhaps Adelaine is confusing old and new syntaxes for -catplot-, but they differ. See http://www.stata.com/statalist/archive/2010-06/msg00431.html for one explanation. > > Nick > n.j.cox@durham.ac.uk > > Leung, Adelaine K.W. > > I'm trying to make a simple categorical graph using catplot. > > The following command works and draws the bars horizonally > catplot group courted if enflp==272 & group!=0 & group!=2 & gal4line==1, percent(courted) > > However, I would like the same graphs drawn with vertical bars using the following command: > > catplot bar group courted if enflp==272 & group!=0 & group!=2 & gal4line==1, percent(courted) > > I get an error: variable bar not found > > Any advice will be great! > > Thanks in advance. > > * > * 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/ * * 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/