/*------------------------------------------------------------------------------------*/ /* * This program selects alphanumeric variables from HCRIS Worksheets that are the old PPS * variables F1 F18 and outputs a SAS dataset * The worksheet code, WKSHT_CD, is as follows : * * "S200000" => "S-2" * * 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 * -- S200000 0100 00100 alpha street * -- S200000 0200 00100 alpha po_box * -- S200000 0100 00101 alpha city * F71* S200000 0200 00101 alpha state * -- S200000 0300 00101 alpha zip * -- S200000 0400 00101 alpha county * F21 S200000 0100 02100 alpha urban/rural * * Note: CMS recently included a separate data file of hospital provider numbers, * hospital names and hospital street addresses in the standard HCRIS documentation. * If the alphanumeric database isn't needed for anything but those fields, * then it may be easier to use the street address file. 2004-06-23. * * by Jean Roth, 2003-12-19 ; * Please report any problems or errors to jroth@nber.org * NOTE: This program is distributed under the GNU GPL. * See http://www.gnu.org/licenses/ for details. * Copyright 2004 shared by the National Bureau of Economic Research and Jean Roth */ /*------------------------------------------------------------------------------------*/ options nocenter; *options obs=10000; libname out v8 '~/bulk'; libname hcris '/homes/data/hcris/'; proc sql; **select appropriate worksheets; create table alpha as select * from hcris.hosp_alpha_long where ( ( WKSHT_CD EQ "S200000" and CLMN_NUM = "0200" and LINE_NUM = "00200" ) or ( WKSHT_CD EQ "S200000" and CLMN_NUM = "0100" and LINE_NUM = "00200" ) or ( WKSHT_CD EQ "S200000" and CLMN_NUM = "0100" and LINE_NUM = "00100" ) or ( WKSHT_CD EQ "S200000" and CLMN_NUM = "0200" and LINE_NUM = "00100" ) or ( WKSHT_CD EQ "S200000" and CLMN_NUM = "0100" and LINE_NUM = "00101" ) or ( WKSHT_CD EQ "S200000" and CLMN_NUM = "0200" and LINE_NUM = "00101" ) or ( WKSHT_CD EQ "S200000" and CLMN_NUM = "0300" and LINE_NUM = "00101" ) or ( WKSHT_CD EQ "S200000" and CLMN_NUM = "0400" and LINE_NUM = "00101" ) or ( WKSHT_CD EQ "S200000" and CLMN_NUM = "0100" and LINE_NUM = "02100" ) ) ; **add varname; data out.alpha; set alpha; length varname $32. ; ; *32-character varname maximum; select; *12345678901234567892123456789312; when ( WKSHT_CD EQ "S200000" and CLMN_NUM = "0200" and LINE_NUM = "00200" ) varname = "prov_num"; 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 = "00100" ) varname = "street" ; when ( WKSHT_CD EQ "S200000" and CLMN_NUM = "0200" and LINE_NUM = "00100" ) varname = "po_box" ; when ( WKSHT_CD EQ "S200000" and CLMN_NUM = "0100" and LINE_NUM = "00101" ) varname = "city" ; when ( WKSHT_CD EQ "S200000" and CLMN_NUM = "0200" and LINE_NUM = "00101" ) varname = "state" ; 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 = "02100" ) varname = "urban_rural" ; otherwise; end; *if varname eq "" then delete; * get rid of any elements of the worksheet we haven't requested; run; proc print data=out.alpha (obs=60);