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?
Related Posts with How to systematically erase the last character of a variable?
How to merge two panel data sets?Dear Statalist members, I want to merge two panel data sets. One contains information regarding 200…
Categorical Variable Types: Ordinal Independent Variable (as opposed to Nominal Independent Variable)I am new to Stata. One of the packages I have prior experience with is SPSS. In SPSS, one can defi…
Prediction graphDear community! I have a task to produce a graph of three realistic scenarios for health spending (i…
Generation of Binary Variables by Probability valuesDear Community. I have variables for 'probability to become obese', 'probabilities of osteoarthrit…
groups within groupsDear all, I hope my post finds you well I have a question concerning panel data. I am currently w…
Subscribe to:
Post Comments (Atom)
0 Response to How to systematically erase the last character of a variable?
Post a Comment