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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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