BookmarkSubscribeRSS Feed
Cynthia_sas
Diamond | Level 26

Hi:
I suggest you go back to the Programming 1 class and review the material on using PROC IMPORT. When you are importing from a multi-sheet workbook, PROC IMPORT expects the OUT= to be a SAS dataset. The Excel Workbook is the equivalent of a library containing multiple tables (one table for each sheet). So a single SAS dataset is all that the OUT= option is going to create.
Are you working in Lesson 2? There is a demo in Lesson 2 that you should revisit, as shown below:

Cynthia_sas_0-1649275388152.png


In this demo, the instructor uses the XLSX LIBNAME engine to run a PROC CONTENTS on the entire workbook and then, after reviewing the PROC CONTENTS output, she shows how to point PROC CONTENTS to a single sheet in the workbook --also using the LIBNAME engine. PROC IMPORT is NOT used in this demo, at all.
In Lesson 2, PROC IMPORT is used to read a tab delimited file and a CSV file -- but you cannot use the XLSX engine to read either of those types of "raw" or "unstructured" data files.
Please clarify exactly in the course where you are working by providing the title of the Lesson, demo, activity or practice you're working in. Most of the activities and practices have code that you can reveal when you're following the instructions. Usually you can compare your code to the solution to see what you've missed. If you're trying to repeat the demo in Lesson 2, you're not following the demo steps.
Cynthia

Kurt_Bremser
Super User

Since libname xlsx can be used to create a new Excel file, the success of assigning the libname does not mean that SAS has found the file; if it did not find the file, it will create it as soon as you write to the library.

So you must first look in your Server Files and Folders section first if the Excel file is actually in myfolders, and take the spelling from there (for the UNIX system of UE, which is case sensitive, Storm.xlsx and storm.xlsx are different files).

 

PS if in doubt, show us a screenshot of the open Server Files and Folders section where the Excel file is visible.

AhmedAl_Attar
Ammonite | Level 13

Follow the instructions from @ChrisHemedinger  2015 Blog

https://blogs.sas.com/content/sasdummy/2015/05/20/using-libname-xlsx-to-read-and-write-excel-files/

 

Try to copy the data/worksheet into a WORK table.

 

Hope this helps,

Ahmed

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 17 replies
  • 3259 views
  • 0 likes
  • 7 in conversation