# Re: st: Graph Question with Svy command

 From Nick Winter To statalist@hsphsun2.harvard.edu Subject Re: st: Graph Question with Svy command Date Wed, 10 May 2006 08:42:18 -0400

I think you can get what you want with teh -collapse- command , followed by an appropriate -graph twoway-

--Nick Winter

At 06:20 PM 5/9/2006, you wrote:

```Hello List, I'm new to stata and have, I hope, a simple question.
I've checked the archives, web, and stata help pages without
finding the answer.  This may also help, I do most of my graphics
in R; so naturally, i'm looking to see if there is an analog to my
R technique with stata.

Here is the problem.  I want to plot a simple bivariate proportions
table.  The rub is that the proportions that I wish to plot come
from a svy command.  Here is an example of the input->output I wish
to plot (year on x, age first intercourse (proportion by year) on
y).

. svy: tab q58 year if grade==1,per col
(running tabulate on estimation sample)

Number of strata   =        56                  Number of obs      =
5271
Number of PSUs     =       144                  Population size    =
428239.69
Design df          =
88

----------------------------------------------------
Age First |
Sex       |
Intercour |                   year
se        |  1997   1999   2001   2003   2005  Total
----------+-----------------------------------------
Never Ha | 66.05  60.36  51.97  60.88  59.03  59.95
11 yr, o | 6.713  7.237   7.62  6.814  8.038  7.266
12 yr, o | 4.607  4.379  9.144  6.341  7.599  6.341
13 yr, o | 9.253  12.41  11.76  11.95  11.43  11.32
14 yr, o | 8.835  10.57  16.58  10.19   11.2  11.29
15 yr, o | 4.268  4.743  2.627  3.703  2.224  3.531
16 yr, o |     0  .3089  .3028  .0952  .4616  .2274
17 yr, o | .2734      0      0  .0199  .0136  .0654
|
Total |   100    100    100    100    100    100
----------------------------------------------------
Key:  column percentages

Pearson:
Uncorrected   chi2(28)        =  110.1731
Design-based  F(., .)         =         .     P =      .

So, what I would like to do is (this would be how I would do it in
R):
1.  output the table with some option or estimation command into a
matrix
2. use the matrix to simply plot each row.

OR, to try any suggestions from the statalist community.

-Mark Orr
*
*   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/
```
________________________________________________________
Nicholas J. G. Winter 607.255.8819 t
Assistant Professor 607.255.4530 f
Department of Government nw53@cornell.edu e
Cornell University falcon.arts.cornell.edu/nw53 w
308 White Hall
Ithaca, NY 14853-4601

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