I have a Shapefile that consists of 52 Districts. Using this Shapefile, I created a new custom polygon provider called "Fish Wildlife Enf Districts", using DISTRICT as the ID Column.
The map above was created as follows:
So far, so good!
I have a data file called "VW_ENFORCEMENT_ACTIONS" that has a column called DISTRICT CODE. It has 60 unique District Codes because it includes historical data, and 8 of the districts have since been incorporated into other districts. As best as I can tell, the DISTRICT CODE values in this file match the DISTRICT values in my map; for example, I have values of "00036" in both. So I would expect that 52 out of 60 would "map" (87%). However, when I try to create a Geography Item using DISTRICT CODE as below, I get 0% mapped.
What am I doing wrong? is it because the DISTRICT and DISTRICT CODE are not formatted exactly the same way?
With such a difference in the lengths of the District variable I would tend to suspect one of them may have leading spaces.
Many times SAS will display values with leading spaces without them.
data work.one; district= ' 00036'; run; data work.two; district= '00036'; run; data work.junk; merge work.one work.two ; by district; run; proc print data= work.junk; run;
The MERGE in the data step considers the values as different so you get two output observations. The proc print appears to have identical values as it will by default strip the leading spaces when printing.
Yes, likely related to the different variable length and potential leading/ending spaces. You may also consider using numeric columns in this case (in both data sets). Unless necessary - your IDs could be simple numbers and you could apply formats such as .Z5 or similar to get the expected formatting. Would make your data set smaller as well - along with avoiding potential matching issues. Let us know how you go. Thanks, Falko
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.
Find more tutorials on the SAS Users YouTube channel.