Daer statalisters:
I am trying to build a matrix that has k-1 rows where k is the number of words in varlist.
I am constructing the matrix by adding one row after another and it works.
(In the code below I am just filling in -1's, they are replaced later)
I then try save the variable names of the x-variables (all variables after the first one). Specifically I'd use the variable names as rownames for the matrix.
I can strip off the first word in varlist with
regexr("`varlist'","`1'","")
. Unfortunately when trying to assign this to a local macro the length of the string
is cut to 80 characters.
Here is the relevant code:
local k : word count `varlist'
tempname A
matrix `A'=(-1)
matrix input `influence_mat'=(-1)
while (rowsof(`influence_mat')< `k'-1) {
matrix `influence_mat' = `influence_mat' \ `A'
}
tokenize `varlist'
local varlist1 = regexr("`varlist'","`1'","") /* works, but cuts down to 80? characters */
matrix rownames `influence_mat' = `varlist1' /* does not work, conformability error */
/* because varlist1 has too few entries */
Any suggestions ? I also would be fine with using hte names as a second column in the matrix
but it doesn't seem like stata likes string entries in columns.
Thanks,
Matt
Matthias Schonlau
Statistician, RAND
412-683-2300 x4917
http://www.rand.org/statistics/bios/stat_schonlau_matthias.html
--------------------
This email message is for the sole use of the intended recipient(s) and
may contain privileged information. Any unauthorized review, use,
disclosure or distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply email and destroy all copies
of the original message.
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/