Statalist The Stata Listserver

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

st: RE: Sensitivity:

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

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

*----------------- begin example -------------
use, 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: )

Hope this helps,

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


*   For searches and help try:

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