We can convert string variables with non-numeric values to numeric variables in Stata using the encode or egen commands.