Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: eclplot - change the order of y-axis variables
From
"Roger B. Newson" <[email protected]>
To
[email protected]
Subject
Re: st: eclplot - change the order of y-axis variables
Date
Fri, 28 Oct 2011 21:03:27 +0100
-eclplot- plots 3 numeric variables (containinng the estimates and the
upper and lower confidence limits) against another numeric variable
(given by the parmid_varname). A numeric variable cannot be ordered
alphabetically.
However, if your numeric parmid_variable was produced using -encode-
from a string variable, then, in default, its numeric values will be
ordered in alphabetic order of its labels.
Is that how you produced your numeric parmid_variable? Because, if this
is the case, then the answer is to encode the original string variable
to a numeric variable using -sencode- instead of -encode-. The -sencode-
package is downloadable from SSC, and is a "super" version of -encode-.
It has a -gsort()- option, which allows the user to sort the numeric
values in a non-alphabetic order. If no -gsort()- option is specified,
then -sencode- encodes in order of appearance of the string values in
the dataset. An example of the use of -sencode- appears in the on-line
help for -eclplot-.
I hope this helps. Let me know if you have any further queries.
Best wishes
Roger
Roger B Newson BSc MSc DPhil
Lecturer in Medical Statistics
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute
Imperial College London
Royal Brompton Campus
Room 33, Emmanuel Kaye Building
1B Manresa Road
London SW3 6LR
UNITED KINGDOM
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Email: [email protected]
Web page: http://www.imperial.ac.uk/nhli/r.newson/
Departmental Web page:
http://www1.imperial.ac.uk/medicine/about/divisions/nhli/respiration/popgenetics/reph/
Opinions expressed are those of the author, not of the institution.
On 28/10/2011 20:19, Sujit Rathod wrote:
I am using Stata/IC 11.2 on Windows
I am trying to create a dot plot with horizontal confidence intervals using -ecplot- and the horizontal option.
(for those trying to visualize, it will look much like a Forest plot used for meta-analysis, except in my case I want to plot individual variables, not individual studies).
Unfortunately, the default appears to be for the y-axis to list all my variables alphabetically, whereas I want them in the order they are listed in my dataset.
Is there a way I can get -eclplot- to change the order in which the parmid_varname is listed in the plot? Or is there an alternative command that may accomplish this?
*
* 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/