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

# Re: st: RE: Graphing the median of a list of variables

 From Jeremy Voros To statalist@hsphsun2.harvard.edu Subject Re: st: RE: Graphing the median of a list of variables Date Wed, 28 Apr 2010 12:42:10 -0400

```With some data clean up and using -collapse - (thank you Nick!) I have a table containing the data I'd like to graph, though I had each year on it's own row and each question as a column.

-xpose- let me transpose the data to make generating the line graph I wanted easy enough. Didn't need -reshape- after all.

Thanks for the help.

-- Jeremy

On Apr 28, 2010, at 6:30 AM, Nick Cox wrote:

> It now does sound like a -reshape- before you draw a graph.
>
> Nick
> n.j.cox@durham.ac.uk
>
> Jeremy Voros
>
> -collapse- looks like it might be the tool I'm looking for. But, the
> data I have are self-assessments of competency in a variety of areas.
> The mean increases as the year increases. I'm trying to devise a method
> of visualizing the responses to all the questions improving over time.
> Putting the year along the x-axis would require a separate graph line
> for each question, of which I have approximately 50, which is too many
> for such a graph.
>
> -grmeanby- is useful too, but it also will only summarize data for a
> single variable.
>
> I'm thinking if I could turn my column variables into row values I'd be
> able to get what I want. So I could have a table like so:
>
> |   question   |   median_1999   |   median_2001   |   etc, for each
> year
> |      1       |       2         |       3         |
> |      2       |       4         |       5         |
>
> then the line graph would be trivial.
>
> I might need to consider another visualization method.
>
> And thanks for the suggestion on the mean.
>
> On Apr 27, 2010, at 2:12 PM, Nick Cox wrote:
>
>> No; I would use -collapse- first.
>>
>> collapse (p50) question*, by(year)
>>
>> After that, it's just a -line- plot. I'd put year on the x axis; any
>>
>> By the way, even though the data are Likert scales, in my experience
>> means in practice often do a much better job of summarising level
>> (regardless of measurement theory).
>
> Jeremy Voros
>
>> Stata newbie here with a question I'm having trouble finding an answer
>> for. I would like to create a line graph with variables along the
> x-axis
>> and their median on the y-axis, with a different line for each
> variable
>> based on the cohort year. Here's the details:
>>
>> My database of likert-scale survey data looks basically like this:
>>
>> |      id     |     year     |     question1     |      question2
> |
>> question3     |     etc...
>> |      5      |     1999     |         1         |          4
> |
>> 3         |
>> |      5      |     2001     |         3         |          4
> |
>> 2         |
>> |      6      |     1999     |         3         |          5
> |
>> 4         |
>>
>>
>> So ultimately I'd like a graph with question1, question2...questionX
>> along the x-axis, and the median of each variable on the y-axis, with
> a
>> different line for each year.
>>
>> I feel like it should involve tabstat or reshape somehow, but can't
>> manage to work it out. Any help appreciated.
>
> *
> *   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/
```