*********************************************************************** Program Function: SAS steps and example code to merge an NHANES 2017-2018 data file with the NHANES 2017-2018 Demographics data. This example uses the "Blood Pressure and Cholesterol" Questionnaire dataset. This merge procedure applies to Exam, Lab, and Questionnaire datasets. Written By: CDC/OSELS/NCHS/DHNES Steps: Please complete the following steps to download the data file from the NHANES website and merge it with select variables from the demographics file: 1. Create two folders on your computer named "C:\CDC" and "C:\CDC\NHANES" (suggested folder names). 2. In a web browser, navigate to the NHANES web page, click "Questionnaires, Data Sets and Related Documentation", click "NHANES 2017-2018". 3. Click "Questionnaire Data", locate the entry for "Blood Pressure & Cholesterol", right-click the associated "Data File" link, choose "Save Target As", and then save the file to "C:\CDC" folder. 4. Click "Demographics Data", right-click the associated "Data File" link, choose "Save Target As", and then save the file to "C:\CDC" folder. 5. Launch your SAS application. Copy and paste the SAS program below to the SAS editor window, then click the Run icon on the SAS toolbar. This code creates a file named BPQ_DEMO that contains blood pressure data merged with the demographic variables RIDAGEYR and RIAGENDR from demo_j.xpt. BPQ_DEMO will be saved in the SAS data library named "C:\CDC\NHANES". ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; LIBNAME DM XPORT 'C:\CDC\demo_j.xpt'; LIBNAME QX XPORT 'C:\CDC\bpq_j.xpt'; LIBNAME OUT 'C:\CDC\NHANES'; DATA OUT.BPQ_DEMO; MERGE DM.DEMO_j (KEEP=SEQN RIDAGEYR RIAGENDR) QX.BPQ_j (IN=A); BY SEQN; IF A; RUN;