# Re: st: RE: RE: Graphics

 From Keith Dear To statalist@hsphsun2.harvard.edu Subject Re: st: RE: RE: Graphics Date Tue, 08 Apr 2008 09:43:06 +1000

My reading of Paticia's question is that she wants something more like this:

forval g=1/5 {
scatter y x if group==`g', by(state, cols(5)) name(g`g')
}

This should create five graphs, each containing 10 scatterplots, one state per plot.
If it doesn't matter which states go in which group, the groups might be set up by:

encode state, gen(istate) // istate is 1..50
gen byte group=(istate+9)/10 // group is 1..5

kd

At 06:17 AM 8/04/2008, you wrote:

```Stata, like any other computer program, does what you tell it to do,
not what you want it to do, and for good reason: How is Stata supposed
to know which states you want to group together?

So, first decide which states you want grouped together in one plot,
than create a variable such that all the state you want to group
together get the same value, call this variable group, than the syntax
provided by Nick will do what you want.

Hope this helps,
Maarten

--- Patricia Yu <pyu1@wisc.edu> wrote:

> Dear Nick:
> Thank you very much for responding.
> I have already tried the syntax you recommended.
> . scatter y x, by(group)
> My problem is below:
> My group is "state."
> I have a dataset which contains 50 states; therefore, I had 50 state
> scatter
> plots in one graphic when I use this syntax.
> Now, I want to only have 10 state scatter plots in one graphic and I
> will
> have five graphics containing all 50 states in the U.S.
> How can I do 10 state scatter plots in one graphic from my 50 state
> dataset?
> Thank you.
> -Patricia
>
> *~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
> PATRICIA YU
> Ph.D. Student & Project Assistant
> Dept. of Educational Leadership & Policy Analysis
> Cell: 608/556-3489
> Home: 608/231-6855
> E-mail: pyu1@wisc.edu
> *~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
>
>
> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu
> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox
> Sent: Monday, April 07, 2008 1:36 PM
> To: statalist@hsphsun2.harvard.edu
> Subject: st: RE: Graphics
>
> Dear Patricia:
>
> Please do not send HTML to the list, just plain text.
>
> You say you have a problem, but you do not say what the problem is,
> for example in terms of code you tried that did not do what you
> wanted.
>
> Let me guess that you have 10 groups of states indicated in
> a variable -group-.
>
> . scatter y x, by(group)
>
> is then one possibility.
>
> Nick
> n.j.cox@durham.ac.uk
>
> Patricia Yu
>
> When I use Stata syntax to run graphics, I encountered a problem.
> I have data for 50 states in the U.S.
> I want to create five graphics. Each graphic contains 10 state
> two-way
> scatter plots.
>
> *
> *   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/
>
> *
> *   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/
>

-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------

___________________________________________________________
Yahoo! For Good helps you make a difference

http://uk.promotions.yahoo.com/forgood/
*
*   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/
```
```
Dr Keith B.G. Dear
Senior Fellow in Biostatistics
National Centre for Epidemiology and Population Health
Australian National University
Canberra, ACT 0200, Australia
Tel: 02 612 54865, Fax: 02 612 50740
http://nceph.anu.edu.au/Staff_Students/staff_pages/dear.php
CRICOS provider #00120C

http://canberragliding.org/

*
*   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/
```