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, is already up and running.

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

st: AW: 'Re-ordering' the labels of a variable

From   "Martin Weiss" <>
To   <>
Subject   st: AW: 'Re-ordering' the labels of a variable
Date   Thu, 25 Mar 2010 13:12:02 +0100


Karen, did you manage to get Stata to display a -histogram- of a string
variable? Does not work for me:


input str1 stringvar byte freq
B 2
A 4
H  5
S 5
Q 1
I 8

expand freq

hist stringvar


-----Ursprüngliche Nachricht-----
[] Im Auftrag von Karen Wright
Gesendet: Donnerstag, 25. März 2010 11:31
Betreff: st: 'Re-ordering' the labels of a variable

Dear All,

I have a diagnosis (string) variable which can take the value: B, A, H, S, Q
or I.  Stata (10.0) cleverly changes this order to an alphabetical order,
however this does not make sense when trying to display a simple histogram
of the distribution.  I would like to force stata to display them in my
original order as it is sensible when considering the ordering of the
diagnosis catergories.

I could do this by changing the string to a numeric variable but I thought
there might be a better way around this?


The Institute of Cancer Research: Royal Cancer Hospital, a charitable
Company Limited by Guarantee, Registered in England under Company No. 534147
with its Registered Office at 123 Old Brompton Road, London SW7 3RP.

This e-mail message is confidential and for use by the addressee only.  If
the message is received by anyone other than the addressee, please return
the message to the sender by replying to it and then delete the message from
your computer and network.

*   For searches and help try:

*   For searches and help try:

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