options nocenter; options linesize=70; *options obs=10000; * The following line should contain the directory where the SAS file is to be stored ; *libname out "~/bulk/cost-reports/hosp/"; libname out "/homes/data/hcris/2552-96"; * The following line should contain the directory where the SAS alphanumeric long file is stored ; %macro loop(fyear=,lyear=); %do year=&fyear. %to &lyear.; *libname y&year. "/home/data/hcris/&year./"; %let dataset=alpha&year.; %let user=; /*------------------------------------------------------------------------------------*/ /* * This program is an example of how to subset variables from HCRIS' alphnmrc database. * It selects variables from HCRIS Worksheets that are the old PPS * variables F1 F18 and F38 and outputs a SAS dataset * * by Jean Roth, jroth@nber.org , 2003-07-25 ; * 60 variables added 2006-05-19 ; * Please report any problems or errors to jroth@nber.org * NOTE: This program is distributed under the GNU GPL. See end of * this file and http://www.gnu.org/licenses/ for details. * * wk_xwalk.sas7bdat is a WKSHT_CD / worksheet label crosswalk. * The worksheet codes, WKSHT_CD, are as follows : * * "S200000" => "S-2" * "S300001" => "S-3, Part I" * "E001000" => "E-1" , ## not in worksheet docs * "E00A18A" => "E, Part A: Hospital Title XVIII" * "E01B18A" => "E, Part A: Subprovider 1, (c) Title XVIII" * "E02B18A" => "E, Part A: Subprovider 2, (c) Title XVIII" * "E03B18A" => "E, Part A: Subprovider 3, (c) Title XVIII" * "E04B18A" => "E, Part A: Subprovider 4, (c) Title XVIII" * "E05B18A" => "E, Part A: Subprovider 5, (c) Title XVIII" * "E06B18A" => "E, Part A: Subprovider 6, (c) Title XVIII" * "E07B18A" => "E, Part A: Subprovider 7, (c) Title XVIII" * "E08B18A" => "E, Part A: Subprovider 8, (c) Title XVIII" * "E09B18A" => "E, Part A: Subprovider 9, (c) Title XVIII" * "E00B18A" => "E, Part A: Subprovider 10, (c) Title XVIII" * "L00A181" => "L, Part I: Hospital Title XVIII" * "L00A191" => "L, Part I: Hospital Title XIX" * * PPS99 WKSHT_CD CLMN_NUM LINE_NUM USAGE Notes/Label * ----- -------- -------- -------- ----- ----------- * F1 S200000 0200 00200 alpha? Provider number - Hospital * F18 S200000 0100 00200 alpha Hospital Name * F38 S200000 0100 02500 alpha Teaching hospital? (Y/N) * F71 S200000 ---- ----- alpha (SSA State Codes are the first two digits of the Medicare Provider Number) * F75 S200000 ---- ----- alpha (This is the UTIL_CD variable in hosp_rpt.zip datafile) * F92 S300001 0100 02500 num Total Beds Available in Facility * F100 S300001 0200 01200 num Total Hospital Bed Days Available * F100 S300001 0201 01200 num Total Hospital Bed Days Available * F165 S300001 0700 02500 num Interns & Residents - Total Facility * F167 S300001 0900 02500 num Net I & R Replacing Non-Phys Anes. - Tot. Fac. * F1828 (above) 0100 01100 num Direct Graduate medial Education Payment * F2153 L00A181 0100 00403 num Indirect Medical Education Adjustment * F2153 L00A191 0100 00403 num Indirect Medical Education Adjustment * F2158 L00A181 0100 00504 num Disproportionate Share Adjustment * F2158 L00A191 0100 00504 num Disproportionate Share Adjustment * * **Page 36-29 of the Cost Reporting Instructions has instructions for CLMN_NUM 2 * for Worksheet S-3, Part I. It says that data from Critical Access Hospitals * (CAHs) has subscripted CLMN_NUMs. * */ /*------------------------------------------------------------------------------------*/ proc sql; **select appropriate worksheets; create table &dataset. as select * from out.hosp_alpha&year._long where ( ( WKSHT_CD EQ "S200000" ) | ( WKSHT_CD EQ "A000000" ) ) ; **add varname; data out.&dataset.&user.; set &dataset.; length varname $32. ; ; *32-character varname maximum; select; *12345678901234567892123456789312; when ( WKSHT_CD EQ "S200000" and CLMN_NUM = "0100" and LINE_NUM = "00100" ) varname = "street" ; when ( WKSHT_CD EQ "S200000" and CLMN_NUM = "0100" and LINE_NUM = "00200" ) varname = "hospname" ; when ( WKSHT_CD EQ "S200000" and CLMN_NUM = "0100" and LINE_NUM = "00101" ) varname = "city" ; when ( WKSHT_CD EQ "S200000" and CLMN_NUM = "0100" and LINE_NUM = "02100" ) varname = "f29"; ** urban or rural ; when ( WKSHT_CD EQ "S200000" and CLMN_NUM = "0100" and LINE_NUM = "02101" ) varname = "dsh"; ** disproportionate share ; when ( WKSHT_CD EQ "S200000" and CLMN_NUM = "0200" and LINE_NUM = "02101" ) varname = "pickle"; ** Pickle amendment ; when ( WKSHT_CD EQ "S200000" and CLMN_NUM = "0100" and LINE_NUM = "02500" ) varname = "f38"; ** teaching hospital ; when ( WKSHT_CD EQ "S200000" and CLMN_NUM = "0100" and LINE_NUM = "02601" ) varname = "s2_c1_2601"; when ( WKSHT_CD EQ "S200000" and CLMN_NUM = "0100" and LINE_NUM = "02602" ) varname = "s2_c1_2602"; when ( WKSHT_CD EQ "S200000" and CLMN_NUM = "0100" and LINE_NUM = "02604" ) varname = "s2_c1_2604"; when ( WKSHT_CD EQ "S200000" and CLMN_NUM = "0100" and LINE_NUM = "03000" ) varname = "s2_c1_3000" ; when ( WKSHT_CD EQ "S200000" and CLMN_NUM = "0100" and LINE_NUM = "03001" ) varname = "s2_c1_3001" ; when ( WKSHT_CD EQ "S200000" and CLMN_NUM = "0100" and LINE_NUM = "03002" ) varname = "s2_c1_3002" ; when ( WKSHT_CD EQ "S200000" and CLMN_NUM = "0100" and LINE_NUM = "03003" ) varname = "s2_c1_3003" ; when ( WKSHT_CD EQ "S200000" and CLMN_NUM = "0100" and LINE_NUM = "03004" ) varname = "s2_c1_3004" ; when ( WKSHT_CD EQ "S200000" and CLMN_NUM = "0200" and LINE_NUM = "00200" ) varname = "prov_num" ; when ( WKSHT_CD EQ "S200000" and CLMN_NUM = "0200" and LINE_NUM = "00200" ) varname = "provider" ; when ( WKSHT_CD EQ "S200000" and CLMN_NUM = "0200" and LINE_NUM = "00100" ) varname = "po_box" ; when ( WKSHT_CD EQ "S200000" and CLMN_NUM = "0200" and LINE_NUM = "00101" ) varname = "state" ; when ( WKSHT_CD EQ "S200000" and CLMN_NUM = "0200" and LINE_NUM = "02601" ) varname = "s2_c2_2601"; when ( WKSHT_CD EQ "S200000" and CLMN_NUM = "0200" and LINE_NUM = "02602" ) varname = "s2_c2_2602"; when ( WKSHT_CD EQ "S200000" and CLMN_NUM = "0200" and LINE_NUM = "02603" ) varname = "s2_c2_2603"; when ( WKSHT_CD EQ "S200000" and CLMN_NUM = "0200" and LINE_NUM = "02604" ) varname = "s2_c2_2604"; when ( WKSHT_CD EQ "S200000" and CLMN_NUM = "0300" and LINE_NUM = "00101" ) varname = "zip" ; when ( WKSHT_CD EQ "S200000" and CLMN_NUM = "0400" and LINE_NUM = "00101" ) varname = "county" ; when (WKSHT_CD EQ "S200000" and CLMN_NUM="0100" and LINE_NUM="04001") varname="chainname"; when (WKSHT_CD EQ "S200000" and CLMN_NUM="0100" and LINE_NUM="04002") varname="chainstreet"; when (WKSHT_CD EQ "S200000" and CLMN_NUM="0100" and LINE_NUM="04003") varname="chaincity"; when (WKSHT_CD EQ "S200000" and CLMN_NUM="0200" and LINE_NUM="04003") varname="chainstate"; when (WKSHT_CD EQ "S200000" and CLMN_NUM="0300" and LINE_NUM="04003") varname="chainzip"; when (WKSHT_CD EQ "S200000" and CLMN_NUM="0100" and LINE_NUM="05301") varname="s2_c1_5301"; when (WKSHT_CD EQ "S200000" and CLMN_NUM="0100" and LINE_NUM="05302") varname="s2_c1_5302"; when (WKSHT_CD EQ "S200000" and CLMN_NUM="0100" and LINE_NUM="05303") varname="s2_c1_5303"; when (WKSHT_CD EQ "S200000" and CLMN_NUM="0200" and LINE_NUM="05301") varname="s2_c2_5301"; when (WKSHT_CD EQ "S200000" and CLMN_NUM="0200" and LINE_NUM="05302") varname="s2_c2_5302"; when (WKSHT_CD EQ "S200000" and CLMN_NUM="0200" and LINE_NUM="05303") varname="s2_c2_5303"; otherwise; end; run; %end; %mend; %loop(fyear=1995,lyear=2011); *%loop(fyear=2005,lyear=2011); *%loop(fyear=1996,lyear=2004); *%loop(fyear=1995,lyear=1995); *%loop(fyear=2004,lyear=2009); *%loop(fyear=1997,lyear=1997); *%loop(fyear=2004,lyear=2004); *%loop(fyear=2005,lyear=2005); *%loop(fyear=2006,lyear=2006); *%loop(fyear=2007,lyear=2007); *%loop(fyear=2008,lyear=2008); *%loop(fyear=2009,lyear=2009); /* Copyright 2003 shared by Jean Roth and the National Bureau of Economic Research National Bureau of Economic Research. 1050 Massachusetts Avenue Cambridge, MA 02138 jroth@nber.org This program and all programs referenced in it are free software. You can redistribute the program or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */