Hi there,
I have a dataset where I`m looking at stores and the products in these stores.
The stores are categorised by types, for example store type 1 means supermarket, store type 2 means small shop and so on.
I`m trying to find how many stores are under each of these types, which I`m able to do, I`m trying to find an easier way to extract my result from the table that Stata gives.
For example, by doing:
Code:
tab store store_type
| Store | Store | Type | Total | ||
| 1 | 2 | 3 | 4 | ||
| 1 | 0 |
62 | 0 | 0 | 62 |
| 2 | 0 | 89 | 0 | 0 | 89 |
| 3 | 158 | 0 | 0 | 0 | 158 |
| 4 | 0 | 0 | 0 | 94 | 94 |
| 5 | 0 | 83 | 0 | 0 | 83 |
| 6 | 0 | 0 | 0 | 71 | 71 |
| 7 | 0 | 9 | 0 | 0 | 9 |
| 8 | 0 | 75 | 0 | 0 | 75 |
| 9 | 0 | 111 | 0 | 0 | 111 |
| 10 | 0 | 120 | 0 | 0 | 120 |
| 11 | 54 | 0 | 0 | 0 | 54 |
| 12 | 0 | 30 | 0 | 0 | 30 |
| 13 | 66 | 0 | 0 | 0 | 66 |
| 14 | 0 | 93 | 0 | 0 | 93 |
| 15 | 0 | 0 | 133 | 0 | 133 |
| 16 | 0 | 132 | 0 | 0 | 132 |
| 17 | 0 | 93 | 0 | 0 | 93 |
| 18 | 0 | 20 | 0 | 0 | 20 |
| 19 | 0 | 0 | 0 | 79 | 0 |
| 20 | 0 | 0 | 129 | 0 | 129 |
| 21 | 40 | 0 | 0 | 0 | 40 |
| 22 | 0 | 44 | 0 | 0 | 44 |
| 23 | 0 | 94 | 0 | 0 | 94 |
| 24 | 93 | 0 | 0 | 0 | 93 |
| 25 | 133 | 0 | 0 | 0 | 133 |
| 26 | 0 | 70 | 0 | 0 | 70 |
| Total | 544 | 1125 | 262 | 244 | 2175 |
Now, by manually counting along the columns where I have figures and not zero, I`m able to determine that there are 6 stores of type 1, 15 of type 2 etc.
My question is, is there any summary command that gives me these totals without needing to manually count, in a clear table?
I have tried tabstat, but this only gives one number. I`ve also tried, sum and tab together but this gives me observations and not how many stores are of type 1 and so on.
Thank you in advance!

Comment