In Stata now, I would like to get the value of this variable (which is a variable name actually) to use it in my regression. Here is an example:
Code:
sysuse auto, clear * R runs through a loop where "somename" changes many times so I want to use * it dynamically in Stata. Say here we are at this one: gen somename="trunk" * now I want to use the value of "somename" (which is the variable name "trunk") * in a regression that should output: reg price mpg trunk * here is how I would usually do this local myname trunk reg price mpg `myname'
Code:
levelsof(somename)
Code:
local myname levelsof(somename) local myname display levelsof(somename)
0 Response to Use a string variable (with one unique entry) to build a local
Post a Comment