In my dataset, s47a means total children given birth to, s47 means dead children,I want to get the number of surviving children using "s47a-s47" and match the number to the household(hhid), but there are a lot of missing value as the picture, so I use egen,
, but that's wrong, I want to find syntax like "rowtotal" but there isn't for minus, what should I do?

Code:
egen ns= s47a-s47
Code:
tabulate s47a S47A | Freq. Percent Cum. ------------+----------------------------------- 0 | 51 0.46 0.46 1 | 5,160 46.28 46.74 2 | 4,049 36.31 83.05 3 | 1,392 12.48 95.53 4 | 355 3.18 98.72 5 | 106 0.95 99.67 6 | 26 0.23 99.90 7 | 8 0.07 99.97 8 | 1 0.01 99.98 9 | 2 0.02 100.00 ------------+----------------------------------- Total | 11,150 100.00 . tabulate s47 S47 | Freq. Percent Cum. ------------+----------------------------------- 0 | 314 26.17 26.17 1 | 648 54.00 80.17 2 | 172 14.33 94.50 3 | 42 3.50 98.00 4 | 15 1.25 99.25 5 | 8 0.67 99.92 9 | 1 0.08 100.00 ------------+----------------------------------- Total | 1,200 100.00
Comment