I know this question has been asked a thousand times, so sorry for asking again. I have read several posts asking similar questions, skimmed the 'search precision' notes and tried changing the storage type to float, with no success.
I am aware of the difference between display formats and storage precision. Here, I want to round a variable to just contain three decimal values - not just change how it looks.
Below is a working example showing that 'round' does nothing when I intend to round var1 to contain only three decimals.
What is the short answer to getting this to work? Thanks!
I am aware of the difference between display formats and storage precision. Here, I want to round a variable to just contain three decimal values - not just change how it looks.
Below is a working example showing that 'round' does nothing when I intend to round var1 to contain only three decimals.
What is the short answer to getting this to work? Thanks!
Code:
clear insobs 1 gen float var1 = 48.3639984131 gen float var2 = round(var1, 0.001) format %20.10f var1 var2 list
Comment