BookmarkSubscribeRSS Feed
axescot78
Quartz | Level 8

Is it possible to import an Excel file using SAS data step?

3 REPLIES 3
PaigeMiller
Diamond | Level 26

It may be possible, but the effort required to write DATA step code from scratch probably isn't worth the effort. PROC IMPORT is one way to go. A LIBNAME statement with engine EXCEL is another way to go.

 

Why do you ask?

--
Paige Miller
ChrisHemedinger
Community Manager

Reading an Excel into SAS is supported by a couple of methods:

  • PROC IMPORT with DBMS=XLSX (there are other DBMS options for older Excel files, but XLSX is generally what is used)
  • LIBNAME XLSX  - treats your Excel file like a library and each sheet is a data set

See this article for more information: How Do I Read and Write Excel Files Using SAS? Q&A, Slides, and On-Demand Recording 

Learn from the Experts! Check out the huge catalog of free sessions in the Ask the Expert webinar series.
ballardw
Super User

Some people misunderstand CSV, a text file format, as an "Excel" file because of the association with the program will often open in Excel by default. For these files a data step is actually the better method to read the files as you control all the details of variable type, name, labels and can even use custom informats to read certain types of problematic values.

 

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 768 views
  • 1 like
  • 4 in conversation