BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
lbarwick
Quartz | Level 8

Hi,

 

Does anyone know if there is a limitation to the number of Excel libraries that can be created in a single session via the excel engine?

 

My code is below. I am using a macro with Excel file locations on my company's network to read in each individual sheet within each Excel file. After the 64th Excel file, SAS fails to read subsequent files.

 


%macro compile (reqnum,tab,sheet,dir);

libname &reqnum excel "&dir" mixed=yes;
data &reqnum.&sheet;
	set &reqnum.."&tab"n;

run;

%mend compile;

data _null_;
set cwrequests;
call
execute('%compile('||reqnum||','||tab||','||sheet||','||dir||')');
run;

I have checked the R349 Excel file/directory that the ERROR references and even excluded that record from my call table to see if it was an issue with that specific Excel file. No matter what I do, the program cuts out after the 64th Excel file...

 

Errors:

 

ERROR: Connect: Unspecified error
ERROR: Error in the LIBNAME statement.
318 +
data R349group1; set R349."group1$"n; drop group; REQNUM="R349"; GROUP1="group1"; if patid>0
then patid_char = strip(put(patid,15.)); else
ERROR: Libname R349 is not assigned.
319 + patid_char=patid; drop patid; rename patid_char=PATID group1=GROUP; keep reqnum site
patid_char group1 patient_id participant_id subject_id; run;

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
Try disconnecting from the library when you're done?
This will de-assign the lib reference.

libname &reqnum;

View solution in original post

2 REPLIES 2
Reeza
Super User
Try disconnecting from the library when you're done?
This will de-assign the lib reference.

libname &reqnum;
lbarwick
Quartz | Level 8
Ah - so simple. Thank you, it worked!

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
  • 2 replies
  • 802 views
  • 2 likes
  • 2 in conversation