My ultimate goal is to create a new variable which only contains the first three number: 001. Thus I can merge the 1st person in the 1st household data set.
I tried to use the code
Code:
generate CG_IDHH = substr(CG_IDFULL, 1, 3)
I think the reason is that current CG_IDFULL is numeric, not string. So I want to convert to string. I use
Code:
tostring CG_IDFULL, generate(CGID)
What should I do?
0 Response to 001002 and 1002 in Stata
Post a Comment