I am working with 2 data sets that contain information about thousands of schools, and in order to match them I am going to use the school code given by the government. The problem is that in one data set the code has 10 characters each, whereas in the other it consists of 11, I have already checked that the schools are the same, it is just that one extra character, how can I erase that extra character from every school code? I am thinking of using a loop, for example: foreach var of school_code {
But then I do not know how to tell stata to erase the last character from every school code. Can you help me?
0 Response to How to systematically erase the last character of a variable?
Post a Comment