0

I have 2 tables in Stata: one shows the count of total parents in each state that had a divorce in the specific divorce year cohort, the other shows the count of divorced parents with csphycus == 2 in each state and divorce year cohort.

I want a table that displays the percentage of parents who has csphycus ==2 for each state and each divorce year cohort. So I want to divide the counts in these two tables. How should I do it?

Community
  • 1
  • 1
  • The images you linked to are not showing. In general, read the Stata tag wiki to learn about posting data examples people can use and showing the code you tried. – Nick Cox Jun 02 '20 at 07:08

1 Answers1

0

Your mean is

egen double numer = total(rdasecwt * (csphycus == 2)), by(statefip yrdivbin) 
egen double denom = total(rdasecwt), by(statefip yrdivbin) 
gen wanted = 100 * numer/denom 

You can show it by some variation on

tabdisp statefip yrdivbin, c(wanted) format(%2.1f) 
Nick Cox
  • 35,529
  • 6
  • 31
  • 47