Dear All,
I try to create a new variable (let's say caseid_copy) based on the original caseid. However, I have problems with its digits. The new variable should be constructed according to original caseid's digit numbers. That is, here is the original data: (I also attached how it looks like). Thank you many times!
caseid
101 8 2
1010 7 5
101010 2
101010 9
Here is the wanted data:
caseid_copy
101 8 (if caseid has three digits in the beginning, I want to drop the last digit which is 2 as above)
1010 7 (if caseid has four digits in the beginning, I want to drop the last digit of caseid which is 5 as above ))
10101 (if caseid has five digits in the beginning, I want to drop the last digit of caseid which is 2 as above . That is, I want to see only the first five digits)
101010 (if caseid has six digits in the beginning, I want to drop the last digit of caseid which is 9 as above. That is,I want to see only the first six digits ) Array
0 Response to parsing a variable based on digits
Post a Comment