Hi,

I am using Stata 17 and need some help with splitting of string variables. Below is an example of my dataset:

Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input str18 autoid
"auto1"
"auto4"
"auto2"
"auto5"
"auto3"
"auto6"
"auto7"
"auto10"
"auto8"
"auto11"
"auto9"
"auto12"
"auto13"
"auto16"
"auto14"
"auto17"
"auto15"
"auto18"
"auto19"
"auto22"
"auto20"
"auto23"
"auto21"
"auto24"
"auto25"
"auto28"
"auto26"
"auto29"
"auto27"
"auto30"
"auto31"
"auto34"
"auto32"
"auto35"
"auto33"
"auto36"
"auto37"
"auto40"
"auto38"
"auto39"
end

What I intend to do is to extract the numeric values and have a new variable called "id". So the new variable would be 1 to 40. I also need to destring the new variables. Is there a command that can split as well as destring a string variable with numeric values?

Thanks!