BookmarkSubscribeRSS Feed
blewsas
Obsidian | Level 7

Hi,

 

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. 

 

52 Regions.jpg

The map above was created as follows:

 

Geography Item.jpg

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.

 

edit geography.jpg

What am I doing wrong?  is it because the DISTRICT and DISTRICT CODE are not formatted exactly the same way?

 

1.jpg

 

2.jpg

 

Thanks!

3 REPLIES 3
FredrikE
Rhodochrosite | Level 12

Hi!

I think the formatting is your problem, make sure they have the same type and length, should fix it 🙂

//Fredrik

ballardw
Super User

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.

Consider:

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.

FalkoSchulz
SAS Employee

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

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Tips for filtering data sources in SAS Visual Analytics

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.

Discussion stats
  • 3 replies
  • 929 views
  • 4 likes
  • 4 in conversation