Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Re: Axis label


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Re: Axis label
Date   Wed, 13 Apr 2011 10:36:51 +0100

split parm, p(-) destring
egen myaxis = group(parm1 parm2)
labmask myaxis, values(parm)

where -labmask- is from SJ (-findit- to get precise location).

Nick

On Wed, Apr 13, 2011 at 10:12 AM, Arti Rayit <arti.rayit@yahoo.com> wrote:
> I have a dataset which has a str5 variable 'parm' of the form 1-2, 1-3, 1-4 etc
> and I want to use this as the variable on the x axis of a twoway scatter plot. I
> have converted this to numeric:
>
> encode parm,gen(id) label(parm)
> twoway (scatter qvs id), xlabel(, valuelabel)
>
> but the new variable has the sort order based on parm:
>  parm   estimate          p         qvs   sid   id |
>     |----------------------------------------------------|
>  1. |   1-2   125.5616   3.83e-29       .0001     1    3 |
>  2. |   1-3   125.5616   3.83e-29       .0001     2    4 |
>  3. |   1-4   125.5616   3.83e-29       .0001     3    5 |
>  4. |   1-5   125.5616   3.83e-29       .0001     4    6 |
>  5. |   1-6   125.5616   3.83e-29       .0001     5    7 |
>     |----------------------------------------------------|
>  6. |   1-7   125.5616   3.83e-29       .0001     6    8 |
>  7. |   1-8   125.5616   3.83e-29       .0001     7    9 |
>  8. |   1-9   125.5616   3.83e-29       .0001     8   10 |
>  9. |  1-10   125.5616   3.83e-29       .0001     9    1 |
>  10. |  1-11   125.5616   3.83e-29       .0001    10    2
>
> which means the first plotted variable is 1-10 rather than 1-2.
>
> How can I sort this so that the plot sequence is 1-2, 1-3 etc.
>
> I am using Stata 11.

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


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index