Download presentation
Published byAntonia Ann Jenkins Modified over 9 years ago
1
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
2
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.
3
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
4
SAS® PROCS & DATA Procedures Data Sets GMAP GPLOT GREMOVE GPROJECT
MAPIMPORT Data Sets MAPS.USCITY MAPS.COUNTY MAPS.USCOUNTY MAPS.CNTYNAME SASHELP.ZIPCODE
5
Obtain Rating Area Data
Center for Consumer Information & Insurance Oversight (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
6
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;
7
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;
8
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;
9
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;
10
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;
11
Maryland Example First map uses MAPS.USCOUNTY Second map
Projected using all states Second map Projected using only Maryland coordinates
12
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
13
City Markers STYLE = 'MARKER' – SAS/GRAPH Font TEXT = 'V' – Star Image
14
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;
15
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;
16
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”
17
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';
18
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;
19
LA Zip Centroids Rating Area 16 Rating Area 15
20
Degrees to Radians 90o = π / 2 = 1.5707 radians
91o = atan(1) / 45 x 91 92o = constant('Pi') / 180 x 92 = radians = = π /2 /4 7π 3π 5π 0o/360o 45o 90o 135o 180o 225o 270o 315o
21
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;
22
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 gplot data=work.LA_Projected; plot LAT*LONG / hreverse html=myhtml name='mypage'; run; ods html close;
23
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)
24
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
25
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
26
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;
27
Result of County Split Rating Area 15 is not Centered
Missing Rating Area Labels (1, 10, 13)
28
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 ; *<-- Offset; y = y ; end; output; *<-- Output original annotation records; * Add labels for non-contiguous areas; if Rating_Area='1' then do; x=-0.015; y= 0.016; output; end; if Rating_Area='10' then do; x= 0.005; y=-0.017; output; end; if Rating_Area='13' then do; x= 0.055; y=-0.072; output; end; run;
29
Rating Areas by Zip Code
Three states use zip codes Alaska, Massachusetts, and Nebraska ZIP code tabulation area (ZCTA) U.S. Census Bureau ESRI® shapefile format (.shp) “Creating ZIP Code-Level Maps with SAS®” SAS Global Forum 2013 (Okerson, Barbara)
30
Import ZCTA Files MAPIMPORT Identify Rating Areas
proc mapimport datafile='tl_2010_25_zcta510.shp' out= work.ZCTA_MA; id ZCTA5CE10; rename ZCTA5CE10 = ZipCode; run; proc format; value $areas '010','011','012','013' = '1' '014','015','016' = '2' '017','020' = '3' '018','019' = '4' '021','022','024' = '5' '023','027' = '6' '025','026' = '7' other = 'Missing'; data work.ZCTA_MA_Modified; length Rating_Area $2; set work.ZCTA_MA; Rating_Area = put(substr(ZipCode,1,3),$areas.); run; proc gremove data= work.ZCTA_MA_Modified out= work.ZCTA_Remove; by Rating_Area; id ZipCode; ... some code not shown ...
31
Project ZCTA Map GPROJECT Note EASTLONG &DEGREES data= work.combined
proc gproject data= work.combined out= work.projected_map dupok eastlong degrees; id Rating_Area; run; proc gmap data= work.projected_map map= work.projected_map anno= work.annotate_data_set all; choro Rating_Area / nolegend; quit;
32
Combine Map Files APPEND Project New Map libname geo_data '.';
%macro by_state ( state ); ... some code not shown ... proc append data=work.Combined out= geo_data.Geo_Rating_Area_Map force; where Major_City ne 1; run; %mend by_state; %by_state ( AK ); %by_state ( AL ); proc gproject data=geo_data.Geo_rating_area_map out=work.Geo_rating_area_map dupok; where state ne stfips('AK') and state ne stfips('HI'); id state Rating_Area; run; proc gmap data= work.Geo_rating_area_map map= work.Geo_rating_area_map all; choro Rating_Area / discrete nolegend; quit;
33
Final U.S. Map
34
Contact Information Rick Andrews Office of the Actuary Centers for Medicare and Medicaid Services 7500 Security Boulevard Baltimore, MD Phone: (410) Robert Allison Research and Development SAS Institute Incorporated 100 SAS Campus Drive Cary, NC 27513 Phone: (919)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.