{
  "id": "1997-november-one-to-many-how-to",
  "slug": "1997-november-one-to-many-how-to",
  "url": "https://dwillis.github.io/uplink/article/1997-november-one-to-many-how-to.html",
  "year": 1997,
  "month": "November",
  "monthNum": 11,
  "headline": "One-to-many how-to",
  "kicker": "Tech Tip",
  "author_name": "Jo Craven",
  "author_title": "",
  "affiliation": "The Washington Post",
  "summary": "A step-by-step guide to using FoxPro programming to match and merge data from two database tables, specifically matching neighborhood names from a lookup table to loan records based on matching Census tract numbers.",
  "keywords": [
    "database",
    "programming",
    "matching"
  ],
  "topics": [
    "Data & Databases",
    "Investigative Methods",
    "Technology"
  ],
  "technologies": [
    "FoxPro",
    "dBase"
  ],
  "full_text": "One-to-many how-to\n\nBy Jo Craven\nThe Washington Post\n\nRecently, I had a large Home Mortgage Disclosure Act table called master.dbf that included a field with Census tract numbers. The various tract numbers appeared repeatedly, indicating the numerous loan applications that came from each area.\n\nI wanted to identify these tracts by their common neighborhood names.\n\nTo do this, with information provided by a local Census Bureau, I created a table called lookup.dbf with two fields: one called \"tract\" with the tract numbers, and the second called \"hood\" with the neighborhood names. Master.dbf already contained a tract field; I added a second corresponding field called \"hood.\"\n\nMy task was to use lookup.dbf to fill in neighborhood names in the newly created and blank \"hood\" field in master.dbf To do this, I wrote the following FoxPro program, which works by advancing through each table, plucking neighborhood names from lookup.dbf and dropping them into master.dbf when the tract numbers from the two tables match.\n\nGetting technical\n\nIn geek speak, this is known as a one-to-many relationship: One record in lookup.dbf corresponded to many records in master.dbf. Here is the program; an explanation follows:\n\nclear\nclear all\nclose all\nuse c:\\master in 1\nuse c:\\lookup in 2\nselect lookup\ndo while not eof ('lookup')\n  scan\n    select master\n    replace master.hood with lookup.hood for master.tract=lookup.tract\n  endscan\n  select lookup\n  skip 1\nenddo\n\nExplanation\n\nclear\nclear all\nclose all\n\nThese introductory commands make sure that you are working with a clean slate - everything is cleared or closed before the program begins.\n\nuse c:\\master in 1\nuse c:\\lookup in 2\nselect lookup\n\nThe two tables are opened with the \"use c:\\master in 1\" and \"use c:\\lookup in 2\" lines. You must still tell the computer which of these files to use first. \"Select lookup\" takes care of this.\n\ndo while not eof ('lookup')\n\nThis acts like a scan loop. It steps through lookup.dbf. The \"not eof\" means \"not end of file\" and instructs the computer to continue working as long as it has not reached the end of lookup.dbf.\n\nscan\n\nselect master\nreplace master.hood with lookup.hood for master.tract=lookup.tract\nendscan\n\nThis nested scan loop then selects the second table, master.dbf, and issues the replace command, which fills in the empty \"hood\" field in master.dbf with a neighborhood name drawn from the \"hood\" field in lookup.dbf when master.tract matches lookup.tract.\n\nselect lookup\nskip 1\n\nThe computer has looked at the first entry in lookup.dbf, then scanned through every record in master.dbf and made the appropriate changes. But the computer still needs to advance to the next record in lookup.dbf and perform the same job. \"Select lookup\" and \"skip 1\" tells the machine to return to lookup.dbf, skip one record, and repeat the procedure. It does this until the computer reaches the end of lookup.dbf.\n\nenddo\n\n\"Enddo\" concludes the \"do while\" command.\n\nJo Craven can be reached at (202) 334-6259 or by e-mail at cravenja@washpost.com.",
  "provenance": {
    "extracted_by": "anthropic/claude-sonnet-4-6",
    "extracted_at": "2026-07-05",
    "verified": true
  },
  "similar": [
    {
      "slug": "1992-december-getting-rid-of-those-pesky-duplicate-records",
      "score": 0.291
    },
    {
      "slug": "1996-february-atlas-gis-has-site",
      "score": 0.23
    },
    {
      "slug": "1993-augustseptember-programming-as-easy-as-sql",
      "score": 0.226
    },
    {
      "slug": "1998-march-cleaning-tables",
      "score": 0.217
    },
    {
      "slug": "1996-november-using-report-writer",
      "score": 0.19
    }
  ],
  "html_url": "https://dwillis.github.io/uplink/article/1997-november-one-to-many-how-to.html",
  "json_url": "https://dwillis.github.io/uplink/article/1997-november-one-to-many-how-to.json"
}