Statalist


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

st: Re: re: labeling question


From   "Joseph Coveney" <[email protected]>
To   "Statalist" <[email protected]>
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
end
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)
exit

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:

1.1
2.3
4.6

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
order?


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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