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

st: Re: re: labeling question

From   "Joseph Coveney" <>
To   "Statalist" <>
Subject   st: Re: re: labeling question
Date   Mon, 29 Dec 2008 10:41:18 +0900

Can you add a prefix to the converted-to-string by-variable that allows for
its sorting properly?  Perhaps something like:

clear *
set more off
input float byvar byte count
1.1 20
2.3 20
4.6 20
10.2 20
expand count
drop count
generate float x = runiform()
generate float y = runiform()
tostring byvar, replace format("%3.1f") force
replace byvar = " " + byvar if length(byvar) < 4
graph twoway scatter y x, by(byvar)

Joseph Coveney

David Airey wrote:

I should say also that graph_by doesn't respect the variable format  command,
although I think it should.

I have a variable that is numeric, like:


but about 20 levels to the variable. I want a to use graph_by where  the by
variable is the above, but I don't want the labels to show  the float
values. I could _string_ the numeric variable and graph_by  that, but then
the order is not numeric on the graph.

How do I rapidly change a float numeric variable to a labeled  numeric
variable such that my graph_by is labeled more neatly, and  in numeric

*   For searches and help try:

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