The last character of the last column name is dropped when naming the matrix and I have no idea why.
Code:
local variables_sum var1 var2 var3 local variables_avg var4 var5 var6 local variables_max var7 var8 local scalar row_cnt = `:word count `variables_sum' +`:word count `variables_avg' +`:word count `variables_max' local cols /// // these are not the real strings, just for example here "String1" /// "String2" /// "String3" /// "String4" /// "String5" /// "String6" /// "String7" /// "String8" /// "String9" /// "String10" /// "String11" /// "String12" /// "String13" /// "String14" /// "String15" local scalar col_cnt = `:word count `cols'' matrix A = J(row_cnt, col_cnt,.) matrix colnames A = `cols'
It also randomly adds a ' " ' to one of the column names too, and I have no clue why as I did not change that code at all. This is frustrating, as I export this matrix to Excel and use it with Python, which then throws errors when the names in the matrix are not what they should be. This was working when I had fewer strings in the macro used to name the columns. Why would it all of a sudden not behave the same way?
Anybody know what is going on?
0 Response to Last character of last string is dropped when using local macro to name matrix columns, bewildering behavior
Post a Comment