Hi,

I would like to combine string variables to make one id for each variable.

The dataset looks like this:
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input byte(statefp countyfp) long tractce double geoid
25 13 801902 25013801902
25 13 801902 25013801902
25 25  50500 25025050500
25 25 170300 25025170300
25 17 341800 25017341800
25 17 385100 25017385100
25 17 339400 25017339400
25 17 339400 25017339400
25 23 510200 25023510200
25 23 510501 25023510501
25 23 510501 25023510501
25 23 510502 25023510502
25  5 645101 25005645101
25  5 645101 25005645101
25  5 650101 25005650101
25  5 650102 25005650102
25  5 650202 25005650202
25 17 316400 25017316400
end
I want to find the code which combines 'statefp' + 0 + 'countyfp' and 'tractce' to make the 'geoid'.

I tried to use -concat-, but the problem is for a one-digit county, I am missing one more '0'. It should be '005' instead of '05.

Thank you very much for your help!

Best,
Ed