Help using Base SAS procedures

Importing NHIS data

Reply
New Contributor
Posts: 2

Importing NHIS data

I am struggling to download, save, and import a dataset into SAS. I want to import each year of the NHIS (CDC's National Health Interview Survey) Sample Child files into SAS to do a proc surveyfreq. 

 

I'm trying the 2013 data release... 

Download data set: 

1. Go to 

https://www.cdc.gov/nchs/nhis/nhis_2013_data_release.htm

2. Click on "Data Files" drop down menu

3. Find "Sample Child File"

4. Click on ASCII zip file (this is the data file that downloads and saves into my H - drive.  

 

Because it's a .dat file, my code cannot read it in SAS. 

 

This is the code I'm trying... 

 

Proc Import OUT=work.childsample2013

DATAFILE= 'H:\Autism\2013samchild.zip'

DBMS=dlm replace;

run;

 

 

This code works fine for the NHIS data from 2016 because its available in an excel file. 

 

Proc Import out=work.childsample

DATAFILE= "H:\Autism\CHILDSample.xlsx"

DBMS=EXCEL REPLACE;

RUN:

 

Any ideas??

THANK YOU!! 

 

 

Super User
Posts: 13,508

Re: Importing NHIS data

Posted in reply to Elizabeth24

Perhaps you should examine the files on the site named "Sample SAS Statements" for each section. The file will have code on how to read the file as well as formats.

 

You would have to modify the code to point to your file paths for in the infile and libname statements.

New Contributor
Posts: 2

Re: Importing NHIS data

Do you know if the newer SAS can open zip files? 

Super User
Posts: 13,508

Re: Importing NHIS data

Posted in reply to Elizabeth24

@Elizabeth24 wrote:

Do you know if the newer SAS can open zip files? 


Yes but limited to files created with WinZip and you couldn't execute the SAS code from inside the ZIp if that is what you are thinking. For one thing the paths in the NHIS code are almost certain not to match yours.

Ask a Question
Discussion stats
  • 3 replies
  • 165 views
  • 0 likes
  • 2 in conversation