global variables - How do I store a LONG list of names in a macro in Stata? -
i need store long list of variable names in stata , after 250 characters, no more characters can stored in local or global macro. currently, i'm using many different globals store names of many regressors using prefer keep them in one.
edit: question has been answered maarten below add code using precision.
local rhsvars = "var1 var2 var3 var4 var5 var6 var7 var8 var9 var10 var11 var12 var13 var14 var15 var16 var17 var18 var19"
does not work
local rhsvars "var1 var2 var3 var4 var5 var6 var7 var8 var9 var10 var11 var12 var13 var14 var15 var16 var17 var18 var19"
does.
this issue largely solved in stata 13, guess have older version.
you can still in older versions leaving out equal sign, can see in example below (it ran in stata 12, in stata 13 both macros not truncated). discussed in following article: nicholas j. cox (2008) "stata tip 70: beware evaluating equal sign" stata journal, 8(4): 586-587. freely available here: http://www.stata-journal.com/article.html?article=pr0045
. // create local equal sign . local = "`c(alpha)' `c(alpha)' `c(alpha)' `c(alpha)' `c(alpha)' `c(alpha)'" . // create local b leaving equal sign out . local b "`c(alpha)' `c(alpha)' `c(alpha)' `c(alpha)' `c(alpha)' `c(alpha)'" . . // local macro gets truncated . di `: length local a' 245 . di "`a'" b c d e f g h j k l m n o p q r s t u v w x y z b c d e f g h j k l m n o p q r s t u v w x > y z b c d e f g h j k l m n o p q r s t u v w x y z b c d e f g h j k l m n o p q r s t > u v w x y z b c d e f g h j k l m n o p q r s . . // local macro b not truncated . di `: length local b' 311 . di "`b'" b c d e f g h j k l m n o p q r s t u v w x y z b c d e f g h j k l m n o p q r s t u v w x > y z b c d e f g h j k l m n o p q r s t u v w x y z b c d e f g h j k l m n o p q r s t > u v w x y z b c d e f g h j k l m n o p q r s t u v w x y z b c d e f g h j k l m n o p q > r s t u v w x y z
Comments
Post a Comment