Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Sensitivity:


From   "Maarten Buis" <[email protected]>
To   <[email protected]>
Subject   st: RE: Sensitivity:
Date   Tue, 1 May 2007 13:27:23 +0200

--- [email protected] wrote:
> A problem with bar graph labels.
> 
> The code designed to replace "0" by "south" and "1" by "other" works for
> "south" but not for "other". Likewise, the code replaces "black" but not
> "other".
>
> The dataset is card.dta, available here:
> http://www.stata.com/texts/eacsap/
> 
> My code is:
>
> graph bar lwage, ///
> over(black, relabel(0 "Other" 1 "Black")) ///
> over(south, relabel(0 "Other" 1 "South"))

The syntax is indeed a bit puzzling (I had to look it up in the manual), 
the number in the relabel option does not refer to the value of the variable 
black or south but to the category number. The manual says: "That is, # 
refers to category number, which is determined by sorting the unique values 
of the variable (in this case, sex) and assigning 1 to the first value, 2 to 
the second, and so on. If you are unsure as to what that ordering would be, 
the easy way to find out is to type -tabulate sex-."  So your code should 
be:

*----------------- begin example -------------
use http://www.stata.com/data/jwooldridge/eacsap/card.dta, clear

graph bar lwage, ///
 over(black, relabel(1 "Other" 2 "Black")) ///
 over(south, relabel(1 "Other" 2 "South"))
*------------------ end example ----------------
(For more on how to use examples I sent to the Statalist, see:
http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html )


Hope this helps,
Maarten

-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology 
Vrije Universiteit Amsterdam 
Boelelaan 1081 
1081 HV Amsterdam 
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434 

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------

 

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