Hi all! I am sorry for asking this basic question, but I am using egen rowmin to select the minimum value between two variables (v1 and v2). The results from rowmin are not EXACTLY the same as the variable with the minimum value for ALL the observations, with decimal points being the main problem. For example, v1 is 3.916571 while the min value is 3.9165709. I tried the following syntax, but it does not work. I would appreciate your help with this. Thank you!!
*///to simplify, I am rounding my v1 and v2 before creating my min variable.
replace v1=round(v1, 0.000001)
replace v2=round(v2, 0.000001)
egen min=rowmin(v1 v2)
*///because both v1 and v2 are double with %10.0g format, I am trying to recast and reformat the min variable.
recast double min
format %10.0g min
replace min=round(min, 0.000001)
*///to simplify, I am rounding my v1 and v2 before creating my min variable.
replace v1=round(v1, 0.000001)
replace v2=round(v2, 0.000001)
egen min=rowmin(v1 v2)
*///because both v1 and v2 are double with %10.0g format, I am trying to recast and reformat the min variable.
recast double min
format %10.0g min
replace min=round(min, 0.000001)

Comment