rounding variable values

Re: rounding variable values

by Michael Peters -
Number of replies: 0

Mariya,

 

  Sorry it took me a little while to figure out how to do this.  Did you try to just generate a new variable using the round command?

such as

gen RoundVar = round(var1, .01) or just using the replace command

replace var1 = round(var1, 0.01)

Both of these options seemed to work for me.  

 

Now, this would only work if you are interested in rounding because you don't need this additional data.  You say that these are procedure codes, does the .00000003 tell you something?  Would you be better off converting these to string variables, and then recoding them as strings?

 

Let me know if this was any help?

Michael