-
Notifications
You must be signed in to change notification settings - Fork 1
NHANEStoMySQL
Tim Erickson edited this page May 15, 2019
·
7 revisions
The NHANES site lets you download SAS transport files (.xpt). But for our system to use them, we need them in MySQL (or some other database that we will access from CODAP/JS).
Do this is RStudio. Here is example code:
open(tidyverse)
library(data.table)
bp <- read_xpt("BPX_I.xpt")
fwrite(bp, file="bp.csv")
Using Sequel Pro, choose File\Import and select the .csv. Check that the column headings are correct; the most common mistake for me has been to fail to indicate that this is going to be a new table.
For the data to appear in the NHANES plugin, you also need to
- Make sure whatever (new) variables you want to appear in the interface are identified in the
varlisttable. - Be sure that any values that need translating are listed (keyed by the internal variable name) in the
decodertable.