Announcement

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

  • Problem using st_store!

    Hello, I have a column vector 200x1 and I created a new variable with this:

    st_addvar("double", "media")

    now I want that the values of my column vector (called: MAR) become the values of my new variable "media" with this:

    st_store(.,1,"media",MAR)

    but stata shows these errors:

    st_store(): 3200 conformability error
    <istmt>: - function returned error

    I've tried using:
    st_store((1::200),1,"media",MAR)
    st_store((1::rows(MAR)),1,"media",MAR)

    but still doesn't work

    Thank you for your help

  • #2
    I suspect that the problem is not with st_store() but with your data. In order for Mata to be able to add 200 rows to your datamatrix, the datamatrix should contain at least 200 rows. If the data in Stata memory has less than 200 observations, then you will get that error. What you could do is:

    Code:
    st_addvar("double", "media")      // create the variable in Stata
    st_addobs(rows(MAR) - st_nobs())  // add any observations in Stata when necessary
    st_store(.,1,"media",MAR)         // store the matrix in Stata
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment


    • #3
      Try to drop 1 from the argument list

      Code:
      st_store((1::200),"media",MAR)
      st_store((1::rows(MAR)),"media",MAR)

      Comment


      • #4
        If the number of observations is less than the number of rows of the matrix you get an out of range error message. That being Lina has not given us the exact error message from her last attemp of modifying the code. st_store() with the first argument missing will trigger a non-conformability error message if the number of rows of MAR is less than the number of observations of the Stata dataset.

        Comment

        Working...
        X