Announcement

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

  • Combine different frequency tables as overview

    Hi together,

    I hope I don't discuss a topic already existing.
    I have built different Indices with different length and I am trying to show them all together in a huge table, like:

    r1 c1 c2
    r2 4.05 5.24
    r3 3.25 24.0
    r4 7.45 23.2
    r5 9.99 24.8
    r6 3.54 .
    r7 7.54 .
    r8 75.5 .
    r9 48.2 .
    r10 2.58 .
    The first idea I had was to store the results in separated matrix' and put them together in the end in a huge matrix. However, it seems not possible to store these matrixes of different length in a combined matrix, like this (of course this data doesn't make sense to combine like in the shown table):

    *Data
    sysuse auto, clear
    tab mpg
    tab rep78

    *Create matrix
    mat graf = J(41, 2, .)
    tab mpg, matcell(al1) //Use mpg table content
    matrix al1 = al1/r(N) //make frequencies to props
    matrix graf[21,1] = al1[21,1] //store properties in my graf

    tab rep78, matcell(al1) //use rep78 table content
    matrix al2 = al1/r(N) //I want properties again
    matrix graf[5,2] = al1[5,1] //trying to store my results in the matrix -->but..

    matrix list graf //list matrix


    The problem is that the only results I get is the one in row 21, col 1 [21,1] and the one in row 5, col2 [5,2]. I understand why this happened; it is because my defined matrix is longer than my inputted data. Could you help me to fix this problem?

    Thank you in advance
    Susi
Working...
X