Hello!
I am currently working with a pretty big dataset, and I am trying to change one variable (which is a regional indicator) so it would contain only first digit / first two digits.
The thing is that this variable has different lengths - it is either 10 digits (ex. 7412000000) or 11 digits (ex. 45333000000) long, and so in the case when it is 10 digits, I want to keep only the first digit, and when it is 11 digits, I want to keep the first two digits.
I am also not sure whether I should replace the values of the original variable, or try to generate a new one.
Thank you for your suggestions in advance!
I am currently working with a pretty big dataset, and I am trying to change one variable (which is a regional indicator) so it would contain only first digit / first two digits.
The thing is that this variable has different lengths - it is either 10 digits (ex. 7412000000) or 11 digits (ex. 45333000000) long, and so in the case when it is 10 digits, I want to keep only the first digit, and when it is 11 digits, I want to keep the first two digits.
I am also not sure whether I should replace the values of the original variable, or try to generate a new one.
Thank you for your suggestions in advance!
Comment