The County That Lost Its First Digit

The County That Lost Its First Digit

An American county can disappear from a newsroom map without anything happening to the county. A spreadsheet changes a five-character code into a four-digit number. The map looks for the five-character version, finds no match and leaves an empty shape. To a reader overseas, the resulting patch can look exactly like a place that reported no activity.

Imagine a correspondent mapping the counties represented in a furniture-making exhibition. The organizers supply a county code for each workshop. A designer has a boundary file with matching codes. The reporter can recognize some county names, yet the codes are what make it possible to connect the list to a national map. Before either desk opens the file, it is worth establishing what each digit is there to do.

Read a code as a name

Ask whether it would ever make sense to add the values in a column. Adding the number of chairs in two consignments is useful. Adding the codes for the counties that sent them is meaningless. A string of digits can function as a name, just like a town or a person’s name. Its individual characters and their order carry the meaning.

The Census Bureau describes a county geographic identifier, or GEOID, as a two-digit state code followed by a three-digit county code. The result has five characters. The county portion alone identifies the county within its state. An exhibition receiving entries from several states needs the state component too. A clerk may know which county a short code means locally, while a national graphics desk has no way to infer that context.

A five-digit ZIP Code and a five-character county GEOID can look equally plausible in adjacent columns. Their purposes differ. One belongs to a postal address, the other identifies a county geography. Label the fields accordingly and check the publisher’s definition of each. Similar length gives no reason to connect a mailing ZIP Code directly to a county boundary field.

Make the first import count

Start with the file exactly as delivered. A plain-text viewer shows whether the leading zeros are actually present in a comma-separated download. Keep that original and import a copy into the spreadsheet. In the import preview, set the relevant identifier columns to text before accepting automatic conversions. Microsoft documents this approach for retaining leading zeros in Excel.

A display format can draw extra zeros in front of a number. It may make a sheet look tidy while leaving a numerical value underneath. Test the value the next operation will actually receive. If the map expects text, the safest working column is a text string that contains every character. Formatting a cell after a long identifier has already lost digits cannot reveal what those digits were.

Take a sample of codes from different parts of the file and compare source to working sheet, character by character. Include one beginning with zero, one with more than one leading zero if the format allows it and one containing a letter or punctuation if such codes are valid in that field. A first-page inspection can miss damage concentrated in one state or one class of identifiers.

Put the pieces together deliberately

Sometimes a workshop list supplies the state and county components in separate fields. In an illustrative row, the components might read 01 and 003. Their five-character combination reads 01003. Adding their numerical values would produce four. Dropping their leading zeros before sticking them together would produce 13. Both operations discard information about where one component ends and the next begins.

Use the documented component widths. Keep the two source fields beside the assembled code until the map is checked. If a component is missing, mark that row for investigation. Filling a blank with zeros can manufacture a perfectly neat string that the source never supplied. A blank state is particularly important because another state can use the same three-character county component.

If the provider delivers a longer identifier, investigate its structure before trimming it. Some Census Bureau products include extra information about the geographic level in front of the location code. Obtain the data dictionary and work out exactly which portion the boundary file takes. A convenient rule based on the last few characters can accidentally turn a record for a different kind of area into a plausible county.

Find the losses before the map does

Compare the number of distinct codes and the distribution of their lengths before and after import. Then compare the actual values with the appropriate official list for the geography and vintage. A string of the right length can still identify the wrong place. Check several matched county names by hand, including entries near the beginning of the alphabet that nobody on the team knows well.

Make a list of workshops whose records cannot be matched to the boundary file. The reason might be a missing zero, a stale geography, a missing state or a different definition of location. Ask whether the address belongs to the workshop, its owner or a shipping depot. A flawless identifier can put the dot precisely in the wrong place for the story.

Pass on a working identifier

Return to the original if zeros have already disappeared. For a documented fixed-width field, padding shorter values can be a defensible repair after checking the source and validating the results. For a variable-length membership number, padding is an invention. If the originals are unavailable and the valid form is uncertain, keep the record unresolved and say how many workshops that affects.

Finally, inspect the actual export in a plain-text view and ask the graphics desk to import its code field as text. A fresh double-click can undo a careful first import. Send one known example with the file so the recipient can verify the join immediately. When the map is ready, the uncolored counties should answer a question about the exhibition, and a reader should be able to learn exactly what that uncolored area means.

U.S. Census Bureau, Understanding Geographic Identifiers

Microsoft Support, Keeping leading zeros and large numbers