Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Re: Bar labels for stacked bar chart (Oct. 2003)


From   Ron�n Conroy <[email protected]>
To   "statalist hsphsun2.harvard.edu" <[email protected]>
Subject   Re: st: Re: Bar labels for stacked bar chart (Oct. 2003)
Date   Fri, 23 Apr 2004 14:01:58 +0100

on 22/04/2004 18:46, Friedrich Huebler at [email protected] wrote:

> . gen barnumber = 1
> . replace barnumber = 2 if country=="B"

I rather like -encode- for this sort of job

. lab def barnumber 1 "A" 2 "B", modify
. encode country , gen(barnumber) label(barnumber)

Notes
* I always put -modify- after label definitions to make sure that a do file
won't run into an already defined label (usually the result of running the
do file a moment earlier)
* -encode-'s option -label- will use the label mappings you have already
defined. Any other string values will be added to the defined value label.
* there is an additional option -noextend- which prevents -encode- from
running if it encounters values that are not in the label you specified.
Handy if you have dodgy things in your data that you are unaware of.

Ronan M Conroy ([email protected])
Lecturer in Biostatistics
Royal College of Surgeons
Dublin 2, Ireland
+353 1 402 2431 (fax 2764)

--------------------
Just say no to drug reps
http://www.nofreelunch.org/

--------------------------------------------------------------------------------------------------------------------
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom
they are addressed.
If you have received this email in error please notify the
originator of the message. This footer also confirms that this
email message has been scanned for the presence of computer viruses.

Any views expressed in this message are those of the individual
sender, except where the sender specifies and with authority,
states them to be the views of The Royal College Of Surgeons in Ireland.

--------------------------------------------------------------------------------------------------------------------
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index