Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# RE: st: RE: RE: RE: RE: comparing yearly surveys (graphs)

 From Lucie Vlach To "statalist@hsphsun2.harvard.edu" Subject RE: st: RE: RE: RE: RE: comparing yearly surveys (graphs) Date Wed, 26 Jan 2011 09:34:02 -0700

```Thank you very much!
I will try this.

Lucie

________________________________________
From: owner-statalist@hsphsun2.harvard.edu [owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox [njcoxstata@gmail.com]
Sent: January 25, 2011 2:31 AM
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: RE: RE: RE: RE: comparing yearly surveys (graphs)

The data at that URL are % very or somewhat satisfied with how
democracy works in various Latin American countries in three years. To
give the flavour, I read a few values very roughly off the graph.

country   satisf   year
Uruguay       52   1996
Uruguay       56   2001
Uruguay       78   2010
Costa Rica       50   1996
Costa Rica       50   2001
Costa Rica       61   2010
Chile       26   1996
Chile       22   2001
Chile       58   2010

The graph is sorted by values in 2010. One way to ensure that is to
put those in a variable.

bysort country (year) : gen satisf2010 = satisf[_N]

Then we use -graph dot-

. graph dot (asis) satisf, over(year) over(country, sort(satisf2010)
desc) asyvars marker(1, ms(Oh)) marker(2, ms(X)) marker(3, ms(Dh))
legend(row(1) pos(12))

As there would be some occlusion otherwise, I used markers Oh and X
that remain visible even with overplotting or major overlap.

To get to this situation from raw scores on a 5 point scale, you would
need to do something like this beforehand.

gen is_satisf = 100 * inlist(score, 4,5)
egen satisf = mean(is_satisf), by(country year)

In fact that could be just

egen satisf = mean(100 * inlist(score, 4,5)), by(country year)

There are many other ways to do it. On -inlist()- see

SJ-6-4  dm0026  . . . . . . Stata tip 39: In a list or out? In a range or out?
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
Q4/06   SJ 6(4):593--595                                 (no commands)
tip for use of inlist() and inrange()

Nick

On Mon, Jan 24, 2011 at 8:51 PM, Lucie Vlach
<Lucie.Vlach@albertahealthservices.ca> wrote:
> yes! on your link, that "Satisfied in Montevideo" scale looks great. How would I do that?
> I have a 5 point scale from unsatisfied to very satisfied...
>
> ________________________________________
> From: owner-statalist@hsphsun2.harvard.edu [owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox [n.j.cox@durham.ac.uk]
> Sent: January 24, 2011 1:16 PM
> To: 'statalist@hsphsun2.harvard.edu'
> Subject: st: RE: RE: RE: comparing yearly surveys (graphs)
>
> I like the graphs at places like
>
> http://www.economist.com/node/17627929
>
> You could do those in Stata (not to mention -scheme(economist)-).
>
> Nick
> n.j.cox@durham.ac.uk
>
>
> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Lucie Vlach
> Sent: 24 January 2011 19:30
> To: statalist@hsphsun2.harvard.edu
> Subject: st: RE: RE: comparing yearly surveys (graphs)
>
> Thank you Nick!
> I am hoping that I do not have to present any overlaps to my audience of this survey. I'll do the catplot (which I really like!) and see how they take it.
> ________________________________________
> From: owner-statalist@hsphsun2.harvard.edu [owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox [n.j.cox@durham.ac.uk]
> Sent: January 24, 2011 12:18 PM
> To: 'statalist@hsphsun2.harvard.edu'
> Subject: st: RE: comparing yearly surveys (graphs)
>
> Specifically on -catplot- from SSC, which I wrote: I don't understand your comment "but it's side by side". Any way, an -hbar- is just the default. You can -recast(bar)- or -recast(dot)-.
>
> I don't understand the enthusiasm here, or indeed anywhere, for overlapping bars, but -catplot- can be coaxed, or coerced, into producing them.
>
> -tabplot- from SSC is also dedicated to categorical data, among other alternatives.
>
> Nick
> n.j.cox@durham.ac.uk
>
> Lucie Vlach
>
> I need to visually compare survey results that will be done each year. (Virtually all same questions each year).
> I have unique IDs for each respondent, and I created a variable for the year as "survey_yr" and use 2010, 2009 etc..
> Is there a nice graph that would show each question comparing by the years?
>
> "our_ID","survey_yr","q1position", etc.....
> "24","2010","1","3.5","13.5","1",etc..."
> "25","2010","1","8","4","2","6","0", etc...
>
> I tried this:
>
> catplot  "myvariable1", percent by (survey_yr) ysize(3) ytitle (Title of the chart) blabel (bar, format (%4.1f))
>
> This works well, but it's side by side. Is there anything that would do either frequencies of the categorical data or percentages that will show the bars overlapping or showing clearly the differences between years?
> I am not very good at Stata, so I am looking for something easy for Stata-dummies.
>
> *
> *   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/
>
> This message and any attached documents are only for the use of the intended recipient(s), are confidential and may contain privileged information. Any unauthorized review, use, retransmission, or other disclosure is strictly prohibited. If you have received this message in error, please notify the sender immediately, and then delete the original message. Thank you.
>
> *
> *   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/
>
> This message and any attached documents are only for the use of the intended recipient(s), are confidential and may contain privileged information. Any unauthorized review, use, retransmission, or other disclosure is strictly prohibited. If you have received this message in error, please notify the sender immediately, and then delete the original message. Thank you.
>
> *
> *   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/

This message and any attached documents are only for the use of the intended recipient(s), are confidential and may contain privileged information. Any unauthorized review, use, retransmission, or other disclosure is strictly prohibited. If you have received this message in error, please notify the sender immediately, and then delete the original message. Thank you.

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