Skip to content

NHANEStoMySQL

Tim Erickson edited this page May 14, 2019 · 7 revisions

The path from SAS transport files to MySQL

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).

SAS transport to CSV

Do this is RStudio. Here is example code:

bp <- read_xpt("BPX_I.xpt")
fwrite(bp, file="bp.csv")

CSV to MySQL

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.

Clone this wiki locally