I'm trying to make a bubble plot using sgmaps with the group option as seen here: https://blogs.sas.com/content/graphicallyspeaking/2018/11/29/proc-sgmap-series-plot-importing-shapef...
My code works fine without the group option, but is throwing the following error when I add it:
97 bubble x=x y=y size=areacodes / group=outlier_flag; _____ 22 76 ERROR 22-322: Syntax error, expecting one of the following: ;, DATALABEL, DATALABELATTRS, DATALABELPOS, FILL, FILLATTRS, LEGENDLABEL, NAME, NOFILL, OUTLINE, TRANSPARENCY. ERROR 76-322: Syntax error, statement will be ignored.
My full code:
data annotations; set sashelp.zipcode(keep=zip areacodes); where zip in (89119,00501); outlier_flag = zip eq 89119; run; proc geocode method=zip data=annotations out=annotations_xy lookupcity=sashelp.zipcode nocity attributevar=(state); run; proc sql noprint; select distinct state into :state_list separated by ',' from annotations_xy; quit; %put &=state_list; data map_boundaries; set maps.states; where state in (&state_list); x = -x * 45/atan(1); y = y * 45/atan(1); run; ods graphics / reset=all imagename="map" imagefmt=png width=1024px height=768px border=off; proc sgmap mapdata=map_boundaries plotdata=annotations_xy; esrimap url='http://services.arcgisonline.com/arcgis/rest/services/Canvas/World_Light_Gray_Base'; choromap / mapid=state density=2; bubble x=x y=y size=areacodes / group=outlier_flag; run; quit;
Setinit excerpt:
Original site validation data Current version: 9.04.01M5P091317 Operating System: LIN X64 . Product expiration dates: ---Base SAS Software ---SAS/STAT ---SAS/GRAPH ---SAS Integration Technologies ---SAS/Secure 168-bit ---SAS Enterprise Guide ---SAS/ACCESS Interface to PC Files ---SAS Workspace Server for Local Access
Is it possible this feature was only just added and doesn't exist in TS1M5? I couldn't find any documentation that clarifies things.
The GROUP= option for the BUBBLE statement is new in SAS 9.4M6. Below is a screen shot from the "What's New" documentation.
It looks like the version tag might be in the wrong spot in the online documentation. I circled the version tag in red in the screen shot below. I think it should be before GROUP=variable, not after the first sentence for GROUP=variable.
I'm using SAS 9.4M6 in SAS University Edition. I downloaded the STATES dataset from http://support.sas.com/rnd/datavisualization/mapsonline/html/archivedmaps.html and tried your code. The SIZE=variable has to be numeric. The areacodes variable is character. I included the areacode variable in the annotations dataset, and then used SIZE=areacode on the BUBBLE statement, with DATALABEL=areacodes as an option.
The image below shows the map.
The GROUP= option for the BUBBLE statement is new in SAS 9.4M6. Below is a screen shot from the "What's New" documentation.
It looks like the version tag might be in the wrong spot in the online documentation. I circled the version tag in red in the screen shot below. I think it should be before GROUP=variable, not after the first sentence for GROUP=variable.
I'm using SAS 9.4M6 in SAS University Edition. I downloaded the STATES dataset from http://support.sas.com/rnd/datavisualization/mapsonline/html/archivedmaps.html and tried your code. The SIZE=variable has to be numeric. The areacodes variable is character. I included the areacode variable in the annotations dataset, and then used SIZE=areacode on the BUBBLE statement, with DATALABEL=areacodes as an option.
The image below shows the map.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.