Hello Statalisters,
I have a dataset and am trying to create a new variable across different levels. What I would like to calculate is the proportion of Total Debt Outstanding by the level of General Revenues. The catch is that I want this data by year and level of government in the data set. I think this might need to happen in two phases, but I'm not quite sure how to proceed. The variables of interest are Year, Name (Type Code will also work), General Revenue-Own Sources, and Total Debt Outstanding. I've attached a data snippet below. The goal is to create a table that shows the corresponding debt ratios across time for each level of government. Note that the Census of Governments (where this data is derived) changed its classification of Municipalities and Cities, which is why Townships and Cities are listed separately in certain years. They do represent different types of sub-state governments, so I'd like to preserve that data when it appears in the table.
I have a dataset and am trying to create a new variable across different levels. What I would like to calculate is the proportion of Total Debt Outstanding by the level of General Revenues. The catch is that I want this data by year and level of government in the data set. I think this might need to happen in two phases, but I'm not quite sure how to proceed. The variables of interest are Year, Name (Type Code will also work), General Revenue-Own Sources, and Total Debt Outstanding. I've attached a data snippet below. The goal is to create a table that shows the corresponding debt ratios across time for each level of government. Note that the Census of Governments (where this data is derived) changed its classification of Municipalities and Cities, which is why Townships and Cities are listed separately in certain years. They do represent different types of sub-state governments, so I'd like to preserve that data when it appears in the table.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input int Year byte TypeCode str18 Name long(GenRevOwnSources TotalDebtOutstanding) 1940 2 "US STATE GOVTS" 3657000 3590000 1940 3 "US LOCAL TOTAL" 5007000 16693000 1940 0 "NATIONAL TOTAL" 14858000 63251000 1940 4 "FEDERAL GOVERNMENT" 6194000 42968000 1950 2 "US STATE GOVTS" 8839000 5285000 1950 3 "US LOCAL TOTAL" 9586000 18830000 1950 0 "NATIONAL TOTAL" 58486000 281472000 1950 4 "FEDERAL GOVERNMENT" 40061000 257357000 1961 2 "US STATE GOVTS" 21911200 19993200 1961 3 "US LOCAL TOTAL" 24995300 55030000 1961 0 "NATIONAL TOTAL" 133968500 363994200 1961 4 "FEDERAL GOVERNMENT" 87062000 288971000 1970 2 "US STATE GOVTS" 57506700 42007700 1970 3 "US LOCAL TOTAL" 51419900 101588500 1970 0 "NATIONAL TOTAL" 272508700 514515100 1970 4 "FEDERAL GOVERNMENT" 163582000 370919000 1980 2 "US STATE GOVTS" 169265645 121957862 1980 3 "US LOCAL TOTAL" 130027382 213645193 1980 6 "US CITIES" 47785892 86018793 1980 7 "US TOWNSHIPS" 5899320 4871455 1980 0 "NATIONAL TOTAL" 716629027 1249919055 1980 4 "FEDERAL GOVERNMENT" 417336000 914316000 1981 2 "US STATE GOVTS" 187373487 134846537 1981 3 "US LOCAL TOTAL" 145735821 229045344 1981 6 "US CITIES" 53406532 91301905 1981 7 "US TOWNSHIPS" 6341256 5377995 1981 0 "NATIONAL TOTAL" 820814308 1367830881 1981 4 "FEDERAL GOVERNMENT" 487705000 1003939000 1982 2 "US STATE GOVTS" 205945387 147470100 1982 3 "US LOCAL TOTAL" 164426048 257108946 1982 6 "US CITIES" 59642958 98420773 1982 7 "US TOWNSHIPS" 6717578 5567670 1982 0 "NATIONAL TOTAL" 866392435 1551565046 1982 4 "FEDERAL GOVERNMENT" 496021000 1146986000 end
Comment