Dear all,
I am working with census tract numbers that are varying lengths, some with decimals and some without. I am trying to get these into a 6 digit string format with no decimals.
For example …
Tract ID (As Is)
401
2301.02
387.01
6-Digit Tract ID (What I Want)
040100
230102
038701
Tracts can be up to 4 digits long before the decimal, so I want leading zeros up to 4 digits. Some tracts have up to 2 digits after the decimal, so I want trailing zeros up to 2 digits. I also want to get rid of the decimal.
If anyone has suggestions or guidance about how I might go about this, I would be very grateful.
I am working with census tract numbers that are varying lengths, some with decimals and some without. I am trying to get these into a 6 digit string format with no decimals.
For example …
Tract ID (As Is)
401
2301.02
387.01
6-Digit Tract ID (What I Want)
040100
230102
038701
Tracts can be up to 4 digits long before the decimal, so I want leading zeros up to 4 digits. Some tracts have up to 2 digits after the decimal, so I want trailing zeros up to 2 digits. I also want to get rid of the decimal.
If anyone has suggestions or guidance about how I might go about this, I would be very grateful.
Comment