Creating Geographic Rating Area Maps: How to Combine Counties, Split Counties, & use Zip Code Boundaries Rick Andrews Office of the Actuary Centers for

Embed Size (px)

DESCRIPTION

Disclaimer The opinions of the speaker(s) are their own and may not reflect those of the Centers for Medicare and Medicaid Services. This lecture is presented "as is" without warranty of any kind, either expressed or implied. Recipients acknowledge and agree that the creator shall not be liable for any damages whatsoever arising out of the use of this material.

Citation preview

Creating Geographic Rating Area Maps:How to Combine Counties,Split Counties, & use Zip Code Boundaries Rick Andrews Office of the Actuary Centers for Medicare and Medicaid Services Robert Allison Research and Development SAS Institute Disclaimer The opinions of the speaker(s) are their own and may not reflect those of the Centers for Medicare and Medicaid Services. This lecture is presented "as is" without warranty of any kind, either expressed or implied.Recipients acknowledge and agree that the creator shall not be liable for any damages whatsoever arising out of the use of this material. Geographic Rating Areas
Affordable Care Act Rate Review Final Rule (45 CFR Part 147) Qualified Health Plans Permitted to impose higher rates in areas where medical costs are higher Three possible scenarios Metropolitan Statistical Areas (MSAs) plus 1 By County By first 3 digits of zip code SAS PROCS & DATA Procedures Data Sets GMAP GPLOT GREMOVE GPROJECT
MAPIMPORT Data Sets MAPS.USCITY MAPS.COUNTY MAPS.USCOUNTY MAPS.CNTYNAME SASHELP.ZIPCODE Obtain Rating Area Data
Center for Consumer Information &Insurance Oversight (CCIIO) https://www.cms.gov/CCIIO Maryland Geographic Rating Areas Rating Area ID County Name 1 Baltimore City Baltimore County Harford County some data not shown 4 Washington County Carroll County Frederick County Obtain FIPS Codes Federal Information Processing Standard (FIPS)
MAPS.CNTYNAME contains county names proc sql; create table work.Rating_Area_FIPS as select T1.*, T2.state, T2.county from work.Rating_Areas as T1 left join MAPS.CNTYNAME as T2 on upcase(T1.County_Name)= T2.COUNTYNM where state = stfips('MD'); quit; Create Map Data Set MAPS.COUNTY contains map coordinates (x,y)
Be cautious of the output sequence using SQL Order of Map data is important proc sql; create table work.Temp_Map as select T1.*, T2.x, T2.y from work.Rating_Area_FIPS as T1 inner join MAPS.COUNTY as T2 on T1.state= T2.state and T1.county = T2.county; quit; Remove County Boundaries
Sort data by State and Rating Area GREMOVE combines unit areas By State and Rating Area ID statement removes county boundaries proc sort data= work.Temp_Map; by state Rating_Area; run; proc gremove data= work.Temp_Map out= work.Gremove_Map; id county; run; Project Rating Area Map
GPROJECT converts spherical coordinates into Cartesian (x,y) coordinates y x proc gproject data= work.Gremove_Map out= work.Rating_Area_Map dupok; id state Rating_Area; run; Projected vs. Un-projected
MAPS.USCOUNTY projected using all states MAPS.COUNTY is un-projected work.Rating_Area_Map projected using MD only proc gmap data= MAPS.USCOUNTY map= MAPS.USCOUNTY all; where state = stfips('MD'); id state county; choro county / woutline=1 nolegend; run; quit; proc gmap data= work.Rating_Area_Map map= work.Rating_Area_Map all; id state Rating_Area; choro Rating_Area / woutline=1 nolegend; run; quit; Maryland Example First map uses MAPS.USCOUNTY Second map
Projected using all states Second map Projected using only Maryland coordinates Add Major Cities MAPS.USCITY coordinates for major cities
data work.Major_Cities; set MAPS.USCITY ( drop= x y ); where state = stfips('MD') and city = 'Baltimore'; retain function 'label' style 'Albany AMT/bold' xsys '2' ysys '2' size 2 color 'black' when 'a'; text = city; * Text value = city name; position = '2'; * Above center of X,Y; * Convert degrees to radians *; x = atan(1)/45 * LONG; y = atan(1)/45 * LAT; Major_City = 1; * Flag for projection; OUTPUT; * Output record for city names; * Prepare city marker values; text='V'; style='marker'; position='5'; OUTPUT; * Output record for markers; run; MAPS.USCITY coordinates for major cities Annotate variables Convert degrees to radians Two OUTPUT statements City Markers STYLE = 'MARKER' SAS/GRAPH Font TEXT = 'V' Star Image Combine & Project Combine map data and major cities
Project the combined data Separate map data and city data Major_City = 1 data work.Combined; set work.Gremove_Map work.Major_Cities; run; proc gproject data= work.Combined out= work.Projected dupok; id state Rating_Area; data work.Rating_Area_Map set work.Projected; if Major_City = 1 then output work.Major_Cities; else output work.Rating_Area_Map; New Map with City Set Labels and Cities tables together
data work.Annotate_Data_Set; set work.Anno_for_Labels work.Major_Cities; run; proc gmap data= work.Rating_Area_Map map= work.Rating_Area_Map anno= work.Annotate_Data_Set all; id state Rating_Area; choro Rating_Area / woutline=1 nolegend; quit; Los Angeles (LA) LA uses first 3 digits of zip code Issue: Solution 1:
Identifies East vs. West Issue: How to split county? Solution 1: Add triangle marker Solution 2: Split County
Annotate ZIP centroids using SASHELP.ZIPCODE %let ra15 = '906','907','908','910','911', '912','915','917','918','935'; %let ra16 = '900','902','903','904','905', '913','914','916','923','928','932'; data work.zipcodes; length function style color $8 position $1; retain xsys ysys '2' hsys '3' when 'a'; set SASHELP.ZIPCODE (rename=(x=LONG y=LAT)); where state = stfips('CA') and CountyNM = 'Los Angeles'; Annotate Zip Centroids
if substr(put(zip,z05.),1,3) in (&ra15) then do; Rating_Area = '15'; color = 'red'; end; if substr(put(zip,z05.),1,3) in (&ra16) then Rating_Area = '16'; color = 'black'; * Convert degrees to radians *; x = atan(1)/45 * LONG * -1; y = atan(1)/45 * LAT; * Create solid-filled pie; function='pie'; style='psolid'; position='5'; rotate=360; size=.2; anno_flag=1; run; LA Zip Centroids Rating Area 16 Rating Area 15 Degrees to Radians 90o = / 2 = 1.5707 radians
91o=atan(1) / 45x 91 92o=constant('Pi') / 180 x 92 = radians = = /2 /4 7 3 5 0o/360o 45o 90o 135o 180o 225o 270o 315o Plot Los Angeles County
Project LA County Create Alt Text data work.LA_Unprojected; set MAPS.COUNTIES; where fipstate(state) = 'CA' and county = 37; LAT=y; LONG=x; run; proc gproject data= work.LA_Unprojected out= work.LA_Projected; id state county; data work.LA_Projected; set work.LA_Projected; length My_Html $300; Original_Order = _N_; My_Html = 'title='|| quote('Original_Order: '|| trim(left(Original_Order))|| '0d'x|| 'x='||trim(left(LONG))|| 'y='||trim(left(LAT))|| ' in radians'); run; Output Delivery System
Create HTML Page Interpol = join Plot LAT * LONG Hreverse option ods html path='c:\mypath' body='mypage.html'; symbol1 value=circle interpol=join color=blue; proc gplotdata=work.LA_Projected; plot LAT*LONG / hreverse html=myhtml name='mypage'; run; ods html close; Create New Coordinates
Alt Text (4) Original start (1) Original end (168) 1st new record x=2.060 (LONG) y=0.595 (LAT) 2nd new record Upper bound (4) Lower bound (65) X X X X x=2.060 (LONG) y=0.595 (LAT) Original Order of LA County Map Coordinates
Old LA Coordinates Note original order 168 observations Original Order of LA County Map Coordinates Original Order State County LONG LAT 1 6 37 2 3 4 some data not shown 165 166 167 168 Original Order of LA County Map Coordinates
New LA Coordinates Note the six new records and new order Original Order of LA County Map Coordinates New Order Original Order Rating Area State County LONG LAT 1 n/a 15 6 37 2 3 4 some data not shown 64 65 16 66 67 170 168 171 172 173 174 New New Copy New New Copy New LA Plot SYMBOL statements PLOT = Rating_Area VALUE = circle & x
COLOR = blue & red PLOT = Rating_Area symbol1 value=circle interpol=join color=blue; symbol2 value=x interpol=join color=red; proc gplot data=work.New_LA; where segment = 1; plot LAT*LONG=Rating_Area / hreverse html=my_html name="&name"; run; Result of County Split Rating Area 15 is not Centered
Missing Rating Area Labels (1, 10, 13) Modify Annotate Data Note the four OUTPUT statements
data work.annotate_data_set_modified; set work.annotate_data_set; * Move label for rating area 15; if Rating_Area='15' then do; x = x ;*