Learning SAS? Welcome to the exclusive online community for all SAS learners.

How to use the XLSX LIBNAME engine to read and write Excel files

Reply
Community Manager
Posts: 2,954

How to use the XLSX LIBNAME engine to read and write Excel files

There are already several excellent discussions about how to work with Microsoft Excel files in SAS University Edition. Most of the techniques involve PROC IMPORT (to read in the spreadsheets) and PROC EXPORT (to create/update workbooks).  For example:

Here's another simple variation that works for XLSX files only: the XLSX LIBNAME engine.  This allows you to read and write Excel content just like data sets in a library, and no special setup is needed when using SAS University Edition.  Here's a simple code example:

/* because Excel field names often have spaces */

options validvarname=any;


libname xl XLSX '/folders/myfolders/sas_tech_talks_15.xlsx';

/* read in one of the tables */

data confirmed;

  set xl.confirmed;

run;


libname xl CLEAR;

I've shared more details in this blog post:

Let me know how it works for you, either here or within comments on the blog.

Chris

Ask a Question
Discussion stats
  • 0 replies
  • 523 views
  • 0 likes
  • 1 in conversation