Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • xsvmat name(col) does not work

    Hi!
    I have a number of matrices that are very similar and I want to save them to then combine them into one dataset using append. I am using xsvmat and everything works fine apart from naming the columns. names(col) does not work, while names(matcol) does (but since all the matrices in question have the same column names, I want the variables named alike for appending the data afterwards).

    Any help is appreciated, thanks!



    Here's the matrix and what I've tried:


    . matlist rent

    | 1ZH 2BE 3LU 4UR 5SZ 6OW 7NW
    -------------+-----------------------------------------------------------------------------
    2004 | -.9671509 -.9720007 -.9789541 -.9689496 -.9738689 -.977413 -.9860313
    2007 | -.9597948 -.9707114 -.9705097 -.8512084 -.9696921 -.9632321 -.9805535
    2010 | -.9690465 -.9641277 -.9631508 -.9833066 -.9658581 -.9663023 -.9661466
    2012 | -.9521551 -.9686751 -.97527 -.9821905 -.9624698 -.9651306 -.9790348

    | 8GL 9ZG 10FR 11SO 12BS 13BL 14SH
    -------------+-----------------------------------------------------------------------------
    2004 | -.9205032 -.9808478 -.8710253 -.9213577 -.9556223 -.9834924 -.9678572
    2007 | -.9795826 -.9746366 -.8735012 -.9432781 -.9473707 . -.9669812
    2010 | -.9753039 -.9739463 -.8777471 -.9158651 -.8720982 -.970527 -.9443256
    2012 | -.9667991 -.977135 -.9139562 -.9158684 -.9300742 -.9824221 -.9658518

    | 15AR 16AI 17SG 18GR 19AG 20TG 21TI
    -------------+-----------------------------------------------------------------------------
    2004 | -.9156434 -.9803567 -.9765518 -.9554469 -.9782571 -.9585166 -.9674364
    2007 | -.8591468 -.9766444 -.9675669 -.9629545 -.9611618 -.9532719 -.962762
    2010 | -.8547766 -.981563 -.9749017 -.9265646 -.9683535 -.9677261 -.9602968
    2012 | -.8131975 -.9793112 -.9762473 -.9060731 -.9687566 -.958657 -.9806254

    | 22VD 23VS 24NE 25GE 26JU type year
    -------------+-----------------------------------------------------------------------------
    2004 | -.9777003 -.9508327 -.9363953 -.9767675 -.9930704 1 2004
    2007 | -.9762236 -.8984141 -.9496031 -.9764711 -.9338188 1 2007
    2010 | -.9736629 -.8665739 -.9258517 -.9690782 -.7122869 1 2010
    2012 | -.9727153 -.8225671 -.8717962 -.955952 -.978319 1 2012




    . xsvmat rent, saving(rent.dta, replace)
    file rent.dta saved

    . xsvmat rent, saving(rent.dta, replace) names(matcol)
    file rent.dta saved

    . xsvmat rent, saving(rent.dta, replace) names(col)
    invalid syntax
    r(198);





  • #2
    For posterity...

    Just had same issue.

    names(col) is trying to save the column names as variable names. Stata does not permit leading digits for variable names, so the command fails to execute.

    Comment

    Working...
    X