Key Concepts about Merging and Appending NHANES Data for CVX Analyses

In addition to combining variables from different files, a typical NHANES analytic dataset will include data from two or more NHANES cycles. You will need to merge data to combine variables from different data files collected during the same cycle and append data files to combine data from different years. Now that you’ve downloaded the necessary data from the 2003-2004 and 2005-2006 NHANES cycles, you are ready to combine the DEMO and PAXRAW files using the merge and append functions. The physical activity monitor data requires a number of steps to calculate the desired outcome metrics from the PAXRAW data. For these steps, we will only use the age variable from the DEMO file. After calculating the summary metrics, we will merge in the rest of the DEMO file. The resulting dataset will form the basis for your analytic dataset.


When merging data, it is important to note the number of records per person in each of the data files you will be using. The DEMO files have one record per person. In contrast, the PAXRAW files include up to 10080 records per study participant who wore an accelerometer, as they detail the intensity counts and other data for each minute of 7 days that the accelerometer was to be worn (7 days x 24 hours x 60 minutes = 10080). In Task 4, the many observations per person will be used to calculate summary metrics and a resulting data file with one observation per person.