I feel like I should be able to easily solve this problem, but after pouring over the PDF manuals, I'm still stumped.
I wish to have a table where the rows are sums of county-level statistics by state (US) with three columns: two columns sum count variables and one column that gives the median ratio (first column/second column).
The three variables are 1) the total applications from HHS offices, 2) the total applications from all sources, and 3) the first divided by the second.
I want the first two columns to use commas and no decimal points, but I cannot get the commas in there and the CA sum keeps using use scientific notation. The third column comes out fine (three decimal points).
It's that simple. What am I missing? Is the problem because the data are county-level and I want data reported at the state level? I don't see why that would be the problem, but I am not sure what is doing on.
Thank you and, yes, I feel like a fool. I'm using Stata/MP 15.1.
Code:
drop hhs_rat* format %13.0fc hhs_apps_total format %13.0fc total_apps gen hhs_ratio = hhs_apps_total/total_apps format %5.3f hhs_ratio table state_abb if statefips<10, c(sum hhs_apps_total sum total_apps median hhs_ratio) cellw(20) /* ---------------------------------------------------------- State | Name | (Abbrevia | tion) | sum(hhs_ap~l) sum(total_~s) mean(hhs_ra~o) ----------+----------------------------------------------- AK | 6090 1079008 0.006 AL | 39093 1439361 0.035 AR | 18507 556911 0.049 AZ | 8059 2943553 0.012 CA | 177354 1.35e+07 0.013 CO | 38028 3195131 0.017 CT | 5060 1247433 0.002 ----------------------------------------------------------
Comment