Hi:
Here's the thing...generally, files with a file extension of .DAT are NOT SAS data sets -- they are "flat" files or "raw" data files that need to be read into SAS dataset form. SAS datasets, starting with Version 7 and higher on Windows and Unix have the file extension of SAS7BDAT -- as in CLASS.SAS7BDAT, SHOES.SAS7BDAT, etc. So if you use Windows Explorer to look at your directory of data files and you only see .DAT files and NOT SAS7BDAT files, then you must run a program to read the "flat" files into SAS form.
The NHANES site has fairly complete information on reading their data using SAS -- you should only need to find the correct SAS program -- an INFILE/INPUT program that is used to read EXAM.DAT into a SAS dataset.
After that program runs successfully, then you will be able to run your PROC SORT and do your further analysis.
Notice that in this program from the CDC, they reference EXAM.DAT in a filename statement and tell you to look for the correct INFILE program that corresponds to your data of choice:
[pre]
http://www.cdc.gov/nchs/tutorials/NHANES/downloads/NHANESIII/NH3_DownloadData_Task3.sas
************************************************************************************************
* Program: C:\NHANES III\NH3_DownloadData_Task3.sas *
* Proposal: Program to modify Filenames and assign Libnames and output to a permanent library *
************************************************************************************************;
Filename In1 "C:\NHANES III\TEMP\EXAM.DAT" LRECL=6235;
Filename In2 "C:\NHANES III\TEMP\ADULT.DAT" LRECL=3348;
Filename In3 "C:\NHANES III\TEMP\YOUTH.DAT" LRECL=2103;
Filename In4 "C:\NHANES III\TEMP\LAB.DAT" LRECL=1979;
/*remember to change your library to the directory location you downloaded your files*/
Libname NH3 "C:\NHANES III\DATA";
/*Cut and paste the SAS code provided on the website beginning with the Data step all the way through to the end.
Copy each of the four sas code files successively.
Be sure that for each one the Infile In statement is correct by specifying
Infile In1, Infile In2, Infile In3, or Infile In4 which corresponds to the SAS code you have just copied over.
Also be sure that your Data statement is also correctly specified as NH3.EXAM, NH3.ADULT, NH3.YOUTH, or NH*/
[/pre]
And then in this web site:
ftp://ftp.cdc.gov/pub/Health_Statistics/NCHS/Datasets/NHANES/NHANESIII/1A/exam.sas
They have a complete program that reads an NHANES EXAM.DAT file. Perhaps between this information and the information on the CDC site, you will be able to convert your .DAT files into SAS datasets and perform your analysis. Here's the link to the NHANES information site:
http://www.cdc.gov/nchs/about/major/nhanes/nh3data.htm
cynthia