The string variable you must convert to numeric. encode
is one option. Then use Stata's factor variable notation (i.e. #
). A nonsensical example:
clear all
set more off
sysuse auto
describe
keep price mpg make
encode make, gen(make2)
regress price mpg c.mpg#i.make2
Factor variable notation was introduced precisely with Stata 11.
Type help factor variables
, help encode
, for the details.
Note: I have not tried to translate your R code to Stata.