Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: Error with -round()-


From   Matt Vivier <[email protected]>
To   [email protected]
Subject   st: Error with -round()-
Date   Sat, 8 Mar 2014 21:46:20 -0500

Hello all,

I'm using:
Stata/IC 12.1 for Windows (64-bit x86-64)
Revision 06 Feb 2012

I'm very hesitant to suggest that there is a bug in Stata itself, but
I am getting an unexpected result when using -round()- on some
numbers, and have been unable to find an explanation for it.

I'm pulling information out of my dataset, and writing it to a table
in an HTML file, and wanted to round the values down to something of
reasonable length. The vast majority of the time, -round()- functions
as expected, but it occasionally seems to misfire.

This can be replicated with:
local value = round(.8125,.01)
di "`value'"

However, if you type
di `value'

You see the expected result.
Unfortunately, (I believe) I have to enclose it in quotes to write it
to the HTML file as such:
file write html `"<TD>`value'</TD>"'

My questions are:
Can anyone replicate this issue?
If so, any thoughts on what causes it? It seems to be caught up in
treating `value' like a string due to the quotes.
Any thoughts on a workaround?

Thanks,

Matt Vivier
Data Analyst
(203) 541-4665
Remedy Partners, Inc

-- 
The information contained in this transmission and any attachments may be 
confidential, proprietary  or privileged, and may be subject to protection 
under applicable law. This transmission is intended for the sole use of the 
individual or  entity to whom it is addressed. If you think you have 
received this transmission in error, please alert 
[email protected] and then delete this e-mail immediately. 
Thank you.
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index