BookmarkSubscribeRSS Feed
MathapeloPh
Calcite | Level 5

 

How to I resolve the error below?

 

NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR
21
22 GOPTIONS ACCESSIBLE;
23 options validvarname=v7;
24 %let path=\\dpc4-75617d\C$\Users\MathapeloPh\Desktop\Move_9093777\Listing Files\Output_Files_Sent_to_Field;
25
26 libname fieldx xlsx "\\%path\PSUs_Segments_161116.xls";
WARNING: Apparent invocation of macro PATH not resolved.
NOTE: Libref FIELDX was successfully assigned as follows:
Engine: XLSX
Physical Name: \\%path\PSUs_Segments_161116.xls
27
28
29 proc contents data=fieldx._ALL_;
30 run;

WARNING: No matching members in directory.
NOTE: PROCEDURE CONTENTS used (Total process time):
real time 0.03 seconds
cpu time 0.04 seconds

3 REPLIES 3
Kurt_Bremser
Super User

A macro variable needs to be adressed as &name. %name would call a macro.

Try

libname fieldx xlsx "\\&path.\PSUs_Segments_161116.xls";

Also note the dot after the macro variable; this makes sure that the macro processor stops scanning for further characters when building the macro variable name.

MathapeloPh
Calcite | Level 5

Thanks @Kurt_Bremser the libname was successfully assigned. Kindly check the warning below it as I now try to read sheets inside the file:

 

libname fieldx xlsx "\\&path.\PSUs_Segments_161116.xls";
NOTE: Libref FIELDX was successfully assigned as follows:
Engine: XLSX
Physical Name: \\\\dpc4-75617d\C$\Users\MathapeloPh\Desktop\Move_9093777\Listing
Files\Output_Files_Sent_to_Field\PSUs_Segments_161116.xls
27
28
29 proc contents data=fieldx._ALL_;
30 run;

WARNING: No matching members in directory.

Kurt_Bremser
Super User

I guess that happens because proc contents (or the contents statement in the datasets procedure) are meant for SAS datasets.

Try this instead:

proc datasets library=fieldx;
quit;

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 1331 views
  • 0 likes
  • 2 in conversation