Hello. I'm trying to learn if there is a way to do operations between columns produced by a table. Starting from the following minimal code example, I'd like to get a table that shows the White/Black ratio of union membership for every age, as the second table shows. Is it possible to do something like this using table/collect commands? I've been reading the manuals, the help, and the forums, and I can't figure it out.
Thanks!
Code:
. sysuse nlsw88, clear
(NLSW, 1988 extract)
. table (age) (race), stat(mean union) nformat(%3.2fc)
----------------------------------------------------
| Race
| White Black Other Total
--------------------+-------------------------------
Age in current year |
34 | 0,32 0,45 0,00 0,35
35 | 0,22 0,22 0,00 0,21
36 | 0,17 0,22 0,00 0,18
37 | 0,24 0,37 0,50 0,29 *0,24/0,37=0,65
38 | 0,21 0,39 0,00 0,26
39 | 0,28 0,32 0,50 0,29
40 | 0,18 0,26 0,20
41 | 0,23 0,24 0,50 0,24
42 | 0,19 0,47 0,50 0,25
43 | 0,24 0,33 0,67 0,27
44 | 0,26 0,18 0,00 0,24
45 | 0,22 0,33 0,25
46 | 0,50 0,50
Total | 0,22 0,30 0,33 0,25
----------------------------------------------------
| Age in current | White/Black |
| 34 | 0.71 |
| 35 | 1.00 |
| 36 | 0.77 |
| 37 | 0.65 |
| 38 | 0.54 |
| 39 | 0.88 |
| 40 | 0.69 |
| 41 | 0.96 |
| 42 | 0.40 |
| 43 | 0.73 |
| 44 | 1.44 |
| 45 | 0.67 |
| 46 | #DIV/0! |
| Total | 0.73 |

Comment