Code:
clear
input pid hid
513 60313
513 60313
513 94
513 94
514 167
514 175
515 175
516 175
end
Code:
gen pid_float = float(pid)
gen pid2 = pid_float*1000000
format pid2 %15.0f
gen hid_float = float(hid)
gen pid_hid = pid2+hid_float
format pid_hid %15.0f
list pid hid pid_float pid2 hid_float pid_hid
+-----------------------------------------------------------+
| pid hid pid_fl~t pid2 hid_fl~t pid_hid |
|-----------------------------------------------------------|
1. | 513 60313 513 513000000 60313 513060320 |
2. | 513 60313 513 513000000 60313 513060320 |
3. | 513 94 513 513000000 94 513000096 |
4. | 513 94 513 513000000 94 513000096 |
5. | 514 167 514 514000000 167 514000160 |
|-----------------------------------------------------------|
6. | 514 175 514 514000000 175 514000160 |
7. | 515 175 515 515000000 175 515000160 |
8. | 516 175 516 516000000 175 516000160 |
+-----------------------------------------------------------+
How can I handle those numbers as normal numbers? Why is hid 60313 rounded to 60320? Thank you very much.
0 Response to How to do calcuations between different datatypes (double, long, float)?
Post a Comment