After a lot of trial and error I managed to get it to work. Here is the full working code and explanation if anyone else runs across this in the future: The issue I seemed to be having was that choromap mapid=??? NEEDS to be "state". Even if I call it fips and the contents of the column are the state fips ID, the column MUST be named state. I named it fips and it did not work or even recognize that it existed. In the end I merged my data with the data from the plot example page because I knew for sure the plot example data worked, so all I had to do was get my state level data merged into it. An issue arose where they both had "State" as a column name, so I had to rename the nurses data state, because as mentioned before, the fips ID must be in a column named "state". This was frustrating to figure out, but now that I know how it works it should be easier in the future. * Get data 1;
filename test1234 url "https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-10-05/nurses.csv";
proc import out=nurses datafile=test1234 dbms=csv replace;
guessingrows = max;
run;
data nurses;
set nurses;
where Year = 2020;
run;
* Renaming state column to something else to try to merge later with another dataset that has a STATE column too;
data nurses2;
set nurses (rename=(State=StateNameFull));
run; PROC SQL;
create table work.nurse_fips3 as
select t1.StateNameFull,
t1.'Total Employed RN'n,
t2.STATENAME,
T2.STATE,
T2.STATECODE
from nurses2 t1
left join sashelp.us_data t2 on (t1.StateNameFull = t2.statename);
quit; data states;
set maps.states;
if state ^in(2,15,72);
x = -x * 45/atan(1);
y = y * 45/atan(1);
run;
data plot_data;
set maps.uscenter;
if state ^in(2,15,72) and ocean^='Y';
long = -long;
statename = fipstate(state);
run;
title 'Total Employed RN by State, 2020';
proc sgmap mapdata=states
maprespdata=work.nurse_fips3
plotdata=plot_data;
esrimap
url='http://services.arcgisonline.com/arcgis/rest/services/
Canvas/World_Light_Gray_Base';
choromap 'Total Employed RN'n / mapid=state density=2
name='choro';
text x=long y=lat text=statename /
textattrs=(size=6pt);
gradlegend 'choro' / title='Total Employed RN, 2020'
extractscale;
run;
quit;
... View more