set logtype text log using cur99.txt, replace set more off set matsize 200 clear set memory 50m infile using cur99.dct * We want to generate estimates of annual spending * We're going to assume that these residents are typical of the cross * section of people who are in the nursing home that year, so that * we simply take the daily expenses and multiply by 365 to get annual * expenses. svyset pweight curwt * Now use: svytotal totcharg if age , etc gen yearchrg = dailychg*365 label var yearchrg "Annual charges, based on daily charges x 365" * For spending, we have info on a primary source and secondary sources * There are ten possible sources: * 1 scpaypi * 2 scpayoi * 3 scpayssi * 4 scpaymcr * 5 scpaymcd * 6 scpaymg * 7 scpayrel * 8 scpayva * 9 scpaynyd * 10 scpayoth * These var's can be 1 for yes or 2 for no. If the sum of these is 20, * then all are "no." If the sum is 19, only one is "yes." * *gen sumsc = scpaypi+scpayoi+scpayssi+scpaymcr+scpaymcd+scpaymg+scpayrel+scpayva+scpaynyd+scpayoth * There are 423 of 8215 obs with more than one "yes," unfortunately * I don't know what "primary source" really means, frankly. * Does it mean "majority?" Or "plurality?" * Let's just assign by primary funding source and forget about * secondary sources for now. * categories for primary source of payment last month, prpaylm * *01 = private insurance *02 = own income, family support, social security benefits, * retirement funds *03 = supplemental security income (ssi) *04 = medicare *05 = medicaid *06 = other govt. assistance or welfare *07 = religious orgs., foundations, agencies *08 = va contracts, pensions, or other va comp. *09 = payment source not yet determined *10 = other *11 = don't know *12 = blank or invalid * * Some of the prpaylsp's indicate something that can be fixed; * assume that all pending cases go through gen prpaylm_r = prpaylm replace prpaylm_r = 11 if prpaylsp == "D/C" replace prpaylm_r = 12 if prpaylsp == "NONE" replace prpaylm_r = 07 if prpaylsp == "HOSPICE" replace prpaylm_r = 05 if prpaylsp == "MEDICAID IS PENDING" replace prpaylm_r = 11 if prpaylsp == "DK" replace prpaylm_r = 04 if prpaylsp == "HOSPICE MEDICARE A" replace prpaylm_r = 02 if prpaylsp == "Private Payment" replace prpaylm_r = 01 if prpaylsp == "HMO" replace prpaylm_r = 01 if prpaylsp == "SECURE HORIZONS PRIME" replace prpaylm_r = 01 if prpaylsp == "PRIMECARE AETNA SR" replace prpaylm_r = 11 if prpaylsp == "DON'T KNOW" replace prpaylm_r = 11 if prpaylsp == "NOT BILLED YET" replace prpaylm_r = 11 if prpaylsp == "NOT SPECIFIED" replace prpaylm_r = 11 if prpaylsp == "OTHER PER DIEM" replace prpaylm_r = 02 if prpaylsp == "PERA (Annuity" replace prpaylm_r = 02 if prpaylsp == "SPECIAL RESIDENT INCOME" replace prpaylm_r = 01 if prpaylsp == "CARE PLUS" replace prpaylm_r = 05 if prpaylsp == "DADE COUNTY" replace prpaylm_r = 01 if prpaylsp == "MEDEX" replace prpaylm_r = 12 if prpaylsp == "NA" replace prpaylm_r = 07 if prpaylsp == "CABRINI HOSPICE" replace prpaylm_r = 12 if prpaylsp == "NOT AVAILABLE" replace prpaylm_r = 01 if prpaylsp == "DSS" replace prpaylm_r = 04 if prpaylsp == "MEDICARE PENDING" replace prpaylm_r = 12 if prpaylsp == "N/A" replace prpaylm_r = 02 if prpaylsp == "PRIVATE FRANURITY FUND" replace prpaylm_r = 02 if prpaylsp == "LIFE CARE CONTRACT" replace prpaylm_r = 05 if prpaylsp == "MEDICAID PENDING" label var prpaylm_r "prpaylm recode" gen chrgpi = . replace chrgpi = yearchrg if prpaylm_r == 1 label var chrgpi "Annual charges to private insurance" gen chrgoi = . replace chrgoi = yearchrg if prpaylm_r == 2 label var chrgoi "Annual charges to own income, etc" gen chrgssi = . replace chrgssi = yearchrg if prpaylm_r == 3 label var chrgssi "Annual charges to SSI" gen chrgmcr = . replace chrgmcr = yearchrg if prpaylm_r == 4 label var chrgmcr "Annual charges to Medicare" gen chrgmcd = . replace chrgmcd = yearchrg if prpaylm_r == 5 label var chrgmcd "Annual charges to Medicaid" gen chrgogov = . replace chrgogov = yearchrg if prpaylm_r == 6 label var chrgogov "Annual charges to other gov't" gen chrgrel = . replace chrgrel = yearchrg if prpaylm_r == 7 label var chrgrel "Annual charges to religious orgs, etc." gen chrgva = . replace chrgva = yearchrg if prpaylm_r == 8 label var chrgva "Annual charges to VA, etc." gen chrgnyd = . replace chrgnyd = yearchrg if prpaylm_r == 9 label var chrgnyd "Annual charges, source not yet determined" gen chrgoth = . replace chrgoth = yearchrg if prpaylm_r == 10 label var chrgoth "Annual charges, other" gen chrgdk = . replace chrgdk = yearchrg if prpaylm_r == 11 label var chrgdk "Annual charges, don't know source" gen chrginv = . replace chrginv = yearchrg if prpaylm_r == 12 label var chrginv "Annual charges, invalid" * Generate 5-year age groups gen agegroup = . replace agegroup = 0 if age >= 0 & age < 5 replace agegroup = 5 if age >= 5 & age < 10 replace agegroup = 10 if age >= 10 & age < 15 replace agegroup = 15 if age >= 15 & age < 20 replace agegroup = 20 if age >= 20 & age < 25 replace agegroup = 25 if age >= 25 & age < 30 replace agegroup = 30 if age >= 30 & age < 35 replace agegroup = 35 if age >= 35 & age < 40 replace agegroup = 40 if age >= 40 & age < 45 replace agegroup = 45 if age >= 45 & age < 50 replace agegroup = 50 if age >= 50 & age < 55 replace agegroup = 55 if age >= 55 & age < 60 replace agegroup = 60 if age >= 60 & age < 65 replace agegroup = 65 if age >= 65 & age < 70 replace agegroup = 70 if age >= 70 & age < 75 replace agegroup = 75 if age >= 75 & age < 80 replace agegroup = 80 if age >= 80 & age < 85 replace agegroup = 85 if age >= 85 & age < 90 replace agegroup = 90 if age >= 90 & age < 95 replace agegroup = 95 if age >= 95 & age < 100 replace agegroup = 100 if age >= 100 & age < 105 replace agegroup = 105 if age >= 105 & age < 110 replace agegroup = 110 if age >= 110 & age < 115 * What we want is a total by age group (and maybe by sex too), so that * we can use that as the numerator with the denominator being either * total population (by age/sex) or total noninstitutionalized pop sort agegroup desc chrgpi svytotal chrgpi , by(agegroup) desc chrgoi svytotal chrgoi , by(agegroup) desc chrgssi svytotal chrgssi , by(agegroup) desc chrgmcr svytotal chrgmcr , by(agegroup) desc chrgmcd svytotal chrgmcd , by(agegroup) desc chrgogov svytotal chrgogov , by(agegroup) desc chrgrel svytotal chrgrel , by(agegroup) desc chrgva svytotal chrgva , by(agegroup) desc chrgnyd svytotal chrgnyd , by(agegroup) desc chrgoth svytotal chrgoth , by(agegroup) desc chrgdk svytotal chrgdk , by(agegroup) desc chrginv svytotal chrginv, by(agegroup) * * To generate age and sex specific groups, sort sex agegroup svytotal chrgpi , by(sex agegroup) svytotal chrgoi , by(sex agegroup) svytotal chrgssi , by(sex agegroup) svytotal chrgmcr , by(sex agegroup) svytotal chrgmcd , by(sex agegroup) svytotal chrgogov , by(sex agegroup) svytotal chrgrel , by(sex agegroup) svytotal chrgva , by(sex agegroup) svytotal chrgnyd , by(sex agegroup) svytotal chrgoth , by(sex agegroup) svytotal chrgdk , by(sex agegroup) svytotal chrginv, by(sex agegroup) set more on /* Old rule I had: pick up all those who were primarily funded by Medicaid last month or who are secondarily funded, or who in the first month were funded */ log close