I'm working with U.S natality birth data, and I need to merge this data by year and county with some other data of economic characteristics of the county. In the first data set (natality) the county variable is composed by the number of the state, plus the number of the county. For example, for TX, which is the state number 44 in the natality dataset, the county variables are 44001, 44002, 44003,... etc. In the other data set I only have the county data: 001, 002, 003... etc.
I need to create a new variable that pastes "44" in front of every value of the county variable in my economic characteristic dataset, for me to be able to do the merge.
This is how it looks now:
county | state |
001 | 48 |
002 | 48 |
003 | 48 |
004 | 49 |
county | state | newvar |
001 | 48 | 44001 |
002 | 48 | 44002 |
003 | 48 | 44003 |
004 | 48 | 44004 |
Thank you very much!
0 Response to Generate new variable pasting numbers or text
Post a Comment