Dear Statalist Users,
Based on these two variables, I need to create a new variable named as caseid where I intend to merge HHID and HVIDX in such a manner:
For example, caseid will be "20010001 01" for the first one and caseid will be "20010001 02" for the second one, and goes like this. Meaning that, if HVIDX is from 1 to 9, I need 0 before the number.
If HVIDX is 10, for example, I need caseid to appear (e.g.,) "20010001 10". Can you please help me? Thank you very much in advance. I am also attaching a second picture of the caseid variable I want:

Based on these two variables, I need to create a new variable named as caseid where I intend to merge HHID and HVIDX in such a manner:
For example, caseid will be "20010001 01" for the first one and caseid will be "20010001 02" for the second one, and goes like this. Meaning that, if HVIDX is from 1 to 9, I need 0 before the number.
If HVIDX is 10, for example, I need caseid to appear (e.g.,) "20010001 10". Can you please help me? Thank you very much in advance. I am also attaching a second picture of the caseid variable I want:
Comment