Hi I have a variable that contains numbers and letters. Ideally, participants had to enter their first two state letter - ex. NY- following by certain numbers and letters.
1 NY12OPR
2 OH34789
3 FL3
4 45OHnmo56
5 ny1234
I would like to extract the first to letter of this string variable which is supposed to be the state. How can I do it in stata. There is another way to deal with this talking into account that some participants did not follow the correct format of entering their IDs such as participant 4 - which does not have their State letter at the beginning or 3 that have two blank spaces at the beginning?
Thank you!
1 NY12OPR
2 OH34789
3 FL3
4 45OHnmo56
5 ny1234
I would like to extract the first to letter of this string variable which is supposed to be the state. How can I do it in stata. There is another way to deal with this talking into account that some participants did not follow the correct format of entering their IDs such as participant 4 - which does not have their State letter at the beginning or 3 that have two blank spaces at the beginning?
Thank you!