Hello everyone,
I am hoping that you all may be able to help with a question that I have been unsuccessfully trying to find an answer to. I would like to create a numeric variable that captures the count of characters in a string variable.

For example, in the dataset auto I would like to create a new variable "new_foreign" that includes the value 8 (corresponding to domestic) and the value 7 (corresponding to foreign).

Is there anyway to do this? The dataset I am working with has many thousands of cases and the character counts for the string variables I am interested in can also be quite long. Thank you all!
Best,
Daniel