Announcement

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

  • Matrix with cells' value equal to a variable's values

    Hello, i have 3 variables for each observation. I want to make a matrix using 2 variables as rows(ATECO code) and coloumns(size of firm) and, the third variable(number of active firms by ATECO code and size) as cells' value. It is possible to do?
    Thank you in advance for your tips

  • #2
    Code:
    help tabulate twoway

    Comment


    • #3
      Thank you for the reply. However, i could not find any help in this function(that i have already used). Could you give me the exact code of the command, if any? Thank you

      Comment


      • #4
        Did you type

        Code:
        help tabulate twoway
        as suggested for help on this command?


        Code:
        . sysuse auto, clear
        (1978 Automobile Data)
        
        
        . tab foreign rep78, matcell(table)
        
                   |                   Repair Record 1978
          Car type |         1          2          3          4          5 |     Total
        -----------+-------------------------------------------------------+----------
          Domestic |         2          8         27          9          2 |        48
           Foreign |         0          0          3          9          9 |        21
        -----------+-------------------------------------------------------+----------
             Total |         2          8         30         18         11 |        69
        
        . mat li table
        
        table[2,5]
            c1  c2  c3  c4  c5
        r1   2   8  27   9   2
        r2   0   0   3   9   9
        
        .

        Comment


        • #5
          Probably i have not explained well the issue. There is a way to command to stata to use the value of a third variable's values(except the two used as row_var and col_var) to fill the cell of the matrix for each combination of the 2 variables used to built the table?

          Comment


          • #6
            You can feed a third variable to the command as weights.

            Comment

            Working...
            X