Step 1: Run Sample SAS Program
Download, open and run the sections of the sample SAS programsas icon for the linked NHANES-Medicaid feasibility file that correspond to this module. This same program will also be used for Modules 7 and 8. This program reads the data and converts it to SAS-formatted files. It is a modified version (including only a subset of variables) of the sample SAS program that can be downloaded from the data linkage FTP site.
Information: A regular left-click may not download the SAS datasets or SAS code correctly. Your browser may try to open and attempt to interpret the contents of the dataset or program. If this happens, right-click the link and save the dataset or program to your hard drive. After the dataset or code has downloaded, use SAS to open and view it.
Explanation of SAS program to create NHANES feasibility file from raw data
Statements |
Explanation |
options ls=120 ps=42 missing=’ ‘ nocenter validvarname=upcase compress=binary; |
Log/List options. COMPRESS option reduces storage requirements for output datasets. |
libname nhanes ‘C:\NHANES’; |
Provides location for reading and saving SAS datasets. |
* Input File Reference *;
filename intext “C:\NHANES\MEDICAID_FEASIBILITY_NHANES_2011_2012.dat”; |
Provides location and name of flat file. |
data nhanes.nhanes_11_12_elig_Medicaid; |
Creates a permanent SAS formatted file with feasibility data for NHANES 2011-2012. |
infile intext lrecl=90 ; |
Directs input statement to read an external file with logical record length=60. |
input
@ 1 SEQN 5.
@15 CMS_MEDICAID_MATCH 1.; |
Reads input values from specified columns and informats and assigns them to the corresponding SAS variables. |
* Labels *;
label
SEQN = ‘NHANES SEQN’
CMS_MEDICAID_MATCH = ‘CMS Medicaid Match Status’ ; |
Assigns descriptive labels to variables in the SAS dataset. |
keep
SEQN
CMS_MEDICAID_MATCH; |
Specifies the variables to include in output SAS dataset. |
proc contents data=nhanes.nhanes_11_12_elig_Medicaid varnum; |
Lists the contents of SAS dataset. VARNUM option prints the list of variables by their position in the dataset. |
proc print data=nhanes.nhanes_11_12_elig_Medicaid (obs=10); |
Prints sample listing of first 10 records. |
proc means data=nhanes.nhanes_11_12_elig_Medicaid; |
Reports the number of observations, the mean, the standard deviation, the minimum value, and the maximum value for each numeric variable in the SAS dataset. |
Step 2: Check Results
Check the SAS log of the program to create the NHANES feasibility file from raw data.
Check that NHANES_11_12_ELIG_MEDICAID.sas7bdat has been created.
Check contents for two variables, SEQN and CMS_ MEDICAID_MATCH, by opening the SAS dataset, NHANES_11_12_ELIG_MEDICAID.sas7bdat.