Hi,
I have a variable displayed like below, It is of type float and format %9.0g. There are two numbers that occurs with more frequency than others, 620.32 and 685.62. I would like to generate a new variable that equals to 1 if var1 takes 620.32 or 685.62. However these numbers actually have more precision than what is displayed. I am struggling with how to do this in a easy way (my current code is gen category=1 if inrange(var1,620.31, 620.33) | inrange(var1,685.61, 685.63)). I tried rounding and recasting the variable as double but the precision doesn't seem to decrease. It would be great if you can suggest a quick way to do this. Thanks!
var1
rate_06
620.32
620.32
620.32
620.32
620.36
620.54
620.54
620.57
685.62
685.62
685.62
685.62
Best,
Angela
I have a variable displayed like below, It is of type float and format %9.0g. There are two numbers that occurs with more frequency than others, 620.32 and 685.62. I would like to generate a new variable that equals to 1 if var1 takes 620.32 or 685.62. However these numbers actually have more precision than what is displayed. I am struggling with how to do this in a easy way (my current code is gen category=1 if inrange(var1,620.31, 620.33) | inrange(var1,685.61, 685.63)). I tried rounding and recasting the variable as double but the precision doesn't seem to decrease. It would be great if you can suggest a quick way to do this. Thanks!
var1
rate_06
620.32
620.32
620.32
620.32
620.36
620.54
620.54
620.57
685.62
685.62
685.62
685.62
Best,
Angela

Comment