{
  "id": "1994-october-calculating-medians-in-paradox",
  "slug": "1994-october-calculating-medians-in-paradox",
  "url": "https://dwillis.github.io/uplink/article/1994-october-calculating-medians-in-paradox.html",
  "year": 1994,
  "month": "October",
  "monthNum": 10,
  "headline": "Calculating medians in Paradox",
  "kicker": "Tech Tips",
  "author_name": "Ray Robinson",
  "author_title": "Reporter",
  "affiliation": "The Press of Atlantic City",
  "summary": "When average values are skewed by outliers, the median provides a more representative number. This article explains a seven-step process for calculating medians in Paradox 4.0 database software, using mortgage income data as an example.",
  "keywords": [
    "median",
    "database",
    "Paradox"
  ],
  "topics": [
    "Data & Databases",
    "Investigative Methods",
    "Technology"
  ],
  "technologies": [
    "Paradox"
  ],
  "full_text": "Any database software can easily calculate the average of a numeric field. But sometimes a few extremely high values skew the average.\n\nWe ran into that with the income field of the Home Mortgage Disclosure Act data for New Jersey. Our MSA, due to some extremely high incomes, was showing the average loan applicant with an income of more than $84,000 per year.\n\nWhen the average is skewed, you can often get a more representative number by calculating the median. That's a little more difficult than calculating an average. Here's how it's done in Paradox 4.0:\n\n1) Query your table, marking the following fields: the field you want to group by; the field you want to calculate as a median (be sure to mark this field with Alt-F6, rather than just F6, so it will include duplicate values in the answer). Rename the answer table to save it.\n2) Sort the table in ascending order, making the median field the last sort field.\n3) Restructure the table, adding a numeric field called RECNO.\n4) Insert the record number Paradox has assigned to each record into the new field. Here's the code:\n\nEDIT \"Tablename\" MOVETO [RECNO] SCAN = RECNO() ENDSCAN DO_IT!\n\n5) Query the resulting table to mark the grouping field and do a CALCAVERAGE on the RECNO field. Rename the answer table to save it.\n\n6) The resulting table will have each value in the grouping field with an average in the RECNO field. Now you need to strip the decimal places off the averages in RECNO. Here's the code:\n\nEDIT \"Tablename\" SCAN IF ([Average of Recno] Int([Average of Recno])) > 0 THEN [Average of Recno] = t([Average of Recno]) COPYTOARRAY arecord DOWN INS COPYFROMARRAY arecord [Average of Recno] = [Average of Recno] + 1 ENDIF ENDSCAN DO_IT!\n\n7) Now set up a multi-line query as follows: In the new table, put an example element in the Average of Recno field. In the earlier table, put the same example element in the Recno field. Mark the grouping field in that table. And in the field you want to calculate as a median, type CALC AVERAGE AS MEDIAN.\n\nThe resulting table should display each value in the grouping field with a median value.\n\nYes, it's a headache. And if you only have one median to figure, it's obviously easier to sort the original table and scroll down to the record number that falls in the middle. But if you want to calculate the median for a number of different groups, it's worth it.\n\nRay Robinson, (609) 272-7273; Primary: 73203.3644@compuserve.com; Secondary: acpress@acy.digex.net",
  "provenance": {
    "extracted_by": "pre-v2",
    "extracted_at": "",
    "verified": true
  },
  "similar": [
    {
      "slug": "1993-aprilmay-an-invitation-for-paradox-users",
      "score": 0.365
    },
    {
      "slug": "1992-june-foxpro-paradox-or-xdb",
      "score": 0.237
    },
    {
      "slug": "2000-januaryfebruary-weighting-data",
      "score": 0.211
    },
    {
      "slug": "1997-april-getting-back-to-basics",
      "score": 0.153
    },
    {
      "slug": "1995-october-getting-access-for-stories",
      "score": 0.132
    }
  ],
  "html_url": "https://dwillis.github.io/uplink/article/1994-october-calculating-medians-in-paradox.html",
  "json_url": "https://dwillis.github.io/uplink/article/1994-october-calculating-medians-in-paradox.json"
}