BookmarkSubscribeRSS Feed
Elizabeth24
Calcite | Level 5

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!! 

 

 

3 REPLIES 3
ballardw
Super User

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.

Elizabeth24
Calcite | Level 5

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

ballardw
Super User

@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.

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 2899 views
  • 0 likes
  • 2 in conversation