Skip to content

Commit

Permalink
add variables for critical care beds
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Sacarny committed Mar 20, 2020
1 parent ce133e2 commit f49c9fc
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 1 deletion.
97 changes: 96 additions & 1 deletion hcris.do
Expand Up @@ -73,7 +73,102 @@ forvalues year=$STARTYEAR/$ENDYEAR {
use rpt_rec_num itm_val_num wksht_cd clmn_num line_num ///
if inlist(wksht_cd,"G300000","G200000","S100000","S300001") ///
using source/hosp_nmrc2552_`fmt'_`year'_long.dta


// critical care beds can be subscripted so e.g. line 8 can have
// subscripts like line 8.1, 8.2, etc. these are identified by looking
// at Worksheet A in the alphanumeric file. there are analogous rows in
// that worksheet which correspond to the subscripts

// subscripts show up with line numbers like 00801, 00802 etc.

// c.f. 2010 documentation:
// Cost center integrity for variable worksheets must be maintained
// throughout the cost report. For subscripted lines, the relative
// position must be consistent throughout the cost report.
// (See Table 3E.) [05/01/2010b]
// EXAMPLE: If you add a neonatal intensive care unit on line 12 of
// Worksheet S-3, Part I, it must also be on the first other special
// care unit line of Worksheet A (line 35), Worksheet D-1, Part II
// (line 47), Worksheet D-2, Part I (line 7), etc.

// also note HOSP2010_README.txt
// 5.2. Extracting data for ICU; CCU: SICU; BICU; and Other ICU:
// The intensive care cost centers that are reported on Worksheets S-3,
// Part I; G-2; D-1; and D-6 are no longer cost center coded. You
// extract the actual line number on the form. For example, if you
// want ICU beds, you should extract Worksheet Code S300001, Line
// Numbers 00800 through 00899, Column 00200.

// for now, we will deal with this by hand and collapse together lines
// 008XX 009XX 010XX 011XX 012XX
// just for column 2 right now

// c.f. 1996 documentation

// The Intensive Care Unit cost centers are also reported on the following worksheets:
// S-3, Part I, Lines 6-10; D-1, Part II, Lines 43-47; D-6, Part I, Lines 2-6; and G-2,
// Part I, Lines 10-14. When extracting data for these lines, do not use the actual
// line number. Use the following cost center codes/line numbers when extracting data:
// Intensive Care Unit: 02600-02619
// Coronary Care Unit: 02700-02719
// Burn Intensive Care Unit: 02800-02819
// Surgical Intensive Care Unit: 02900-02919
// Other Special Care Unit: 02140-02159, 02080-02099, 02060-02079,
// 02180-02199, 02040-02059, 02120-02139

// For example, on the worksheet form the Intensive Care Cost Center is on Line 6; however, do not
// use Line 6, use Lines/Codes 02600 thru 02619.

// now collapse together lines 02600-02619 ... etc

if (`fmt'==10) {

display "collapsing together bed counts for critical care beds (2010 fmt)"

foreach linepfx in "008" "009" "010" "011" "012" {
replace line_num="`linepfx'00" ///
if wksht_cd=="S300001" & ///
substr(line_num,1,3)=="`linepfx'" & ///
clmn_num=="00200"
}

}
else if (`fmt'==96) {

display "collapsing together bed counts for critical care beds (1996 fmt)"

gen linepre = substr(line_num,1,3)
gen linepost = real(substr(line_num,4,2))
assert !missing(linepost)

foreach linepfx in "026" "027" "028" "029" {
replace line_num="`linepfx'00" ///
if wksht_cd=="S300001" & ///
linepre=="`linepfx'" & ///
inrange(linepost,0,19) & ///
clmn_num=="0100"
}

replace line_num="02140" ///
if wksht_cd=="S300001" & ///
( ///
( ///
linepre=="021" & ///
( inrange(linepost,20,59) | inrange(linepost,80,99) ) ///
) | ///
( ///
linepre=="020" & inrange(linepost,40,99) ///
) ///
) & ///
clmn_num=="0100"

}

assert !missing(itm_val_num)

gen count = 1
collapse (sum) itm_val_num count, by(rpt_rec_num wksht_cd clmn_num line_num) fast

// identify the variables we need and label the rows

// merge with the lookup table
Expand Down
Binary file modified misc/lookup.xlsx
Binary file not shown.

0 comments on commit f49c9fc

Please sign in to comment.