It's really difficult to know how to help you, without knowing all the info about your custom map and the dataset you're trying to plot. This might be a problem that would be better to work directly with tech support to figure out.
Here is one scenario that generates the error you're seeing - a data= dataset that has no non-missing values (but I can't say whether or not your dataset has no non-missing values - this is just a wild "shot in the dark").
data foo;
statecode='NC'; salary=.;
run;
proc gmap data=foo map=mapsgfk.us;
id statecode;
choro salary;
run;
ERROR: No valid levels for a map.
Hello Robert,
Thank you for your feedback. I took the same approach to code and restarted the whole code from scratch and here are the results.
FILENAME op2013 "/home/pandyad0/sasuser.v94/Outpatient_CY2013.csv" TERMSTR=crlf;
PROC IMPORT DATAFILE=op2013
OUT=WORK.op2013
DBMS=CSV
REPLACE;
GETNAMES=YES;
guessingrows=44353;
RUN;
proc contents data=op2013;
run;
data WORK.op2013V1; set WORK.op2013;
ZCTA5CE10_char=put(ZCTA5CE10,5.);
drop ZCTA5CE10;
rename ZCTA5CE10_char=ZCTA5CE10;
run;
proc MAPIMPORT datafile="/home/pandyad0/sasuser.v94/tl_2010_us_zcta510.shp" out=zshape;
run;
ods graphics on;
filename odsout '/home/pandyad0/sasuser.v94';
GOPTIONS DEVICE=png;
ODS HTML style=statistical path=odsout body="map3.html";
pattern1 v=s c=cx00ff00;
pattern2 v=s c=cxffee00;
pattern3 v=s c=cxffdc00;
pattern4 v=s c=cxff0000;
proc gmap data=WORK.op2013V1 map=zshape;
id ZCTA5CE10;
choro AverageTotalPayments / levels=4 coutline=same;
run;quit;
ODS HTML close;
ods graphics off;
By the way, data was taken from this site-- https://data.cms.gov/Medicare/Outpatient-Prospective-Payment-System-OPPS-Provide/ks44-5ax3
how do I set legend in range of values, from lowest to highest with various colors, like equal to 11 would be green. And hgihest would be red.
how to separate legend with set range from 11.84 to 400.00 = green, 400 to 800 yellow and 800 to 1400 = red.
There are a few different ways to control the legend 'binning', but here is the one I would recommend for your situation. It gives you total control of the way the data is split into the legend bins, and how those bins are labeled.
First you use a data step and 'if' statements to assign each data line to a legend bin, and then you create a user-defined format to specify how you want those legend bins to be labeled. In Proc Gmap, be sure to use the 'discrete' option!
Here's a simple example demonstrating the technique:
data foo; set sashelp.us_data;
if population_2010<5000000 then legend_bin=1;
else if population_2010<=20000000 then legend_bin=2;
else if population_2010>20000000 then legend_bin=3;
run;
proc format;
value bin_fmt
1="<5 million"
2="5-20 million"
3=">20 million"
;
run;
pattern1 v=s c=lime;
pattern2 v=s c=orange;
pattern3 v=s c=red;
proc gmap data=foo map=maps.us all;
label legend_bin='Population:';
format legend_bin bin_fmt.;
id statecode;
choro legend_bin / discrete;
run;
The answer is in 2 parts ... first, you have to use the 'all' option so that the borders of the areas with no response data actually show up in the map:
proc gmap data=WORK.op2013V1 map=zshape all;
And then you can specify 'cdefault=gray' as a choro option after the / to make the areas with no data be filled with gray.
Hello Robert,
I am just confuse on I how can place grey color on empty zip code levels. I am still not able to figure out.
There were TWO errors: error 22-322: Syntax error
Looks like there's a problem in the proc gmap line ...
74 proc gmap data=WORK.op2013V1 map=zshape all / choro cdefault=gray;
75 id ZCTA5CE10;
76 choro AverageTotalPayments / levels=4 coutline=same;
I think it should be more like ...
74 proc gmap data=WORK.op2013V1 map=zshape all;
75 id ZCTA5CE10;
76 choro AverageTotalPayments / levels=4 coutline=same;
Hello Robert,
Thank you for your answer. It worked and it looks like this:
Now, I have mine the data and made a subset of the data. And I wanted to make two different US states map.
In my dataset, I have AmbulatoryPaymentClassificationGroup, AverageTotalPayments, and Provider State.
I am using your example code from data foo (previously posted to show me on legend on this thread). and "http://support.sas.com/kb/41/776.html" .
two AmbulatoryClassificationG levels with US states. I wanted to have two US states ,map with each Levels (which are in Two levels 0209 and 0377), Do you know how I can assign PROC GMAP automatically to this data set and have the SAS make US states map with abbreviated states based on Average Total Payments values.
I am just frustrated on how I can align my data with the any example data. Any help is greatly appreciated.
Thank you.
@pandyat0 wrote:
Now I just realized that I am trying to sum the Average Total Payments values by Provider States for each AmbulatoryPaymentClassificationG.
What I have done so far is created subset for each Levels (337 nd 209). Now I just have to sum those AverageTotalPayments by states.
I am trying this. https://communities.sas.com/t5/SAS-Procedures/sums-and-counts-by-group/m-p/49057#M13309
But I do not know what is that smiley face represents.
Thanks.
-Tarak.
Smiley face is colon right parentheses. : + ) with no plus sign 🙂
Thanks. It worked. I also used maps.us to map the data after abbreviated the data by state. Thanks.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.