Home > Data Services > Catalog . Restricted Data . Census . ACS

Search Data Services

Meta Search
search across all the following databases:

Data Catalog
Data and documentation

KnowledgeBase
Common questions and answers.

Resources
Entire collection of data resources.


Latest Data News

RSS Feed icon

Tools: Data as Text

More fun with names

Counting Same-Sex Couples

The Antidote for “Anecdata”: A Little Science Can Separate Data Privacy Facts from Folklore

Big Data: NYC Taxi Cab Trips

Data Services Knowledge Base

Q:  

I am unsure how to merge geographic data to a file that I have. I noticed that the census tract numbers do not stand alone in the data file that I downloaded from the census and that the GEO variable is saved as a text variable so I am unable to merge my data sets using that variable.

Would you be willing to show me how to link these two data sets if all I have is the census tract number?

A:  

Census tract numbers are only unique within a county. You need to create a unique id based on state, county, and census tract.

Thus, the following:

st   county  tract
26   113     60202

can be combined into a unique id:

26113602002

This is done via this algorithm:

id = (st*1000000000) + (county*1000000) + tract;  

In your data, you may only have the census tract, but ideally you know the state and county as well. Otherwise, if your data are for a single county within a state, you can just use the tract portion of the GEO_ID2 variable. If you save the item as 'text' it is in fixed format with state in the first two columns, county in the next three columns, and tract in the last 6 columns. Thus, you could read:

input junk 1-5 and tract as 6-11;

Related Question Groups: