BookmarkSubscribeRSS Feed
Aiman
Fluorite | Level 6

Hi, I tried to import and read my xlsx data to sas studio, im running into this error "XLSX not valid for import" and "FILE.WORK.IMPORT.DATA doest not exist", this is the code that I run , it is from sas snippet library. 

 

/* Generated Code (IMPORT) */
/* Source File: raw input data.xlsx */
/* Source Path: /Users/maiman.khalid/My Folder/raw input data.xlsx */
/* Code generated on: May 4, 2020, 4:05:09 PM */

proc sql;
%if %sysfunc(exist(WORK.IMPORT)) %then %do;
    drop table WORK.IMPORT;
%end;
%if %sysfunc(exist(WORK.IMPORT,VIEW)) %then %do;
    drop view WORK.IMPORT;
%end;
quit;



FILENAME REFFILE FILESRVC FOLDERPATH='/Users/maiman.khalid/My Folder'  FILENAME='raw input data.xlsx';

PROC IMPORT DATAFILE=REFFILE
	DBMS=XLSX
	OUT=WORK.IMPORT;
	GETNAMES=YES;
RUN;

PROC CONTENTS DATA=WORK.IMPORT; RUN;

proc print data=work.import(obs=3);
run;

 

2 REPLIES 2
andreas_lds
Jade | Level 19

Please post the full log as text.

AhmedAl_Attar
Ammonite | Level 13

Try using the xlsx libname engine instead

/* because Excel field names often have spaces */
options validvarname=any;
 
libname xl XLSX "/folders/myfolders/raw input data.xlsx";   *<--- Change the path;
 
/* discover member (DATA) names */
proc datasets lib=xl; quit;

/* read in one of the tables */
data work.import;
  set xl.<Sheet Name>;  *<--- Change the SHEET Name;
run;
libname xl CLEAR;

Hope this helps,

Ahmed

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

Develop Code with SAS Studio

Get started using SAS Studio to write, run and debug your SAS programs.

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
  • 2 replies
  • 2790 views
  • 0 likes
  • 3 in conversation