Statalist The Stata Listserver


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

RE: st: Precision and ordering issue in histograms titles


From   "MA V" <[email protected]>
To   [email protected]
Subject   RE: st: Precision and ordering issue in histograms titles
Date   Thu, 25 Jan 2007 00:08:10 +0000

I mentioned in my initial post that:
"So, after reading some of the previous posts on the precision issues in Stata I concluded that one way to achieve nice titles would be to create a string variable, i.e. gen Xstring=string(X). Now the titles of the plot come out fine when I replace <by(X)> with <by(Xstring)>. The only problem is that the plots do not come out ordered by X (i.e. from the smallest X to the largest X) anymore..."

So, I did see the solution you mention but then the problem has to do with the ordering of the histograms...

Is there any way of getting around the precision issue without losing the ordering of the histograms? (in my case I have 15 histograms and I would like to have them ordered by X)

Thanks,
MA



From: "Nick Cox" <[email protected]>
Reply-To: [email protected]
To: <[email protected]>
Subject: RE: st: Precision and ordering issue in histograms titles
Date: Wed, 24 Jan 2007 23:59:24 -0000

One answer is to be found in a concurrent thread:

. gen SX1 = string(X1, "%02.1f")

. twoway histogram mpg, by(SX1)


Nick
[email protected]

MA V

> Svend replied:
>
> This is a precision problem. Try to declare X double precision:
>
>    sysuse auto
>    gen double X=0.8-foreign
>    twoway histogram mpg , by(X)
> -------------------------------------------------
>
> Unfortunately in my case this does not seem to work...
> Suppose you do
>
> sysuse auto, clear
> gen X=0.8-foreign
> gen double X1=X
> twoway histogram mpg , by(X1)
>
> this still gives histograms with not so pretty titles...
>
> How can I create histograms by X, with nice titles, and
> without losing the
> order of the histograms?
>

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