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

Please help me with this error.

 

%include "E:\program\monthly.sas";
%let sum=E:\data\datamonthly_&yr._&month..xls;

 

%data(&yr,&month,&sum);

 

Capture.PNG

where monthly.sas:

 

%macro data(year,month,lib);

libname s "&lib";

%mend data;

1 ACCEPTED SOLUTION

Accepted Solutions
Patrick
Opal | Level 21

Then it appears you have a solution for writing an Excel.

 

The error message could be a bit more descriptive but I'm pretty sure that the error you're getting is caused by a SAS component not being installed or configured and started. Most likely it's the PC File Server (which comes as part of SAS/Access to PC Files but needs post-installation configuration to work)

View solution in original post

11 REPLIES 11
Patrick
Opal | Level 21

You need to get your libname statement correct by adding the XLSX engine (SAS/Access to PC files needs to be licensed for this to work).

 

Also: The macro parameter in your code is YEAR not YR. You should use this one within the macro.

 

%let year=2015;
%let month=10;
libname s xlsx "E:\data\datamonthly_&year._&month..xls";

 

 

zay
Calcite | Level 5 zay
Calcite | Level 5
Thanks Patrick. But, how would I know if I have this (SAS/Access to PC files needs to be licensed for this to work)?
SASKiwi
PROC Star

Run: proc setinit noalias; run;

zay
Calcite | Level 5 zay
Calcite | Level 5
Thanks SASKiwi.
zay
Calcite | Level 5 zay
Calcite | Level 5

@Patrick wrote:

You need to get your libname statement correct by adding the XLSX engine (SAS/Access to PC files needs to be licensed for this to work).

 

Also: The macro parameter in your code is YEAR not YR. You should use this one within the macro.

 

%let year=2015;
%let month=10;
libname s xlsx "E:\data\datamonthly_&year._&month..xls";

 

 



SAS/Access to PC files has licensed but I got the same error.

SASKiwi
PROC Star

Try EXCEL as the engine name rather than XLSX. I'm pretty sure XLSX is only possible with SAS 9.4 M2 or later.

 

There are a few other things that may cause this error, but let's just try one thing at a time.

zay
Calcite | Level 5 zay
Calcite | Level 5

@SASKiwi wrote:

Try EXCEL as the engine name rather than XLSX. I'm pretty sure XLSX is only possible with SAS 9.4 M2 or later.

 

There are a few other things that may cause this error, but let's just try one thing at a time.


Still, got the same error. 

Patrick
Opal | Level 21

I can replicate the error when not using the XLSX engine. As @SASKiwi wrote you need SAS9.4 for the XLSX engine.

 

Both the EXCEL and XLSX engine require SAS/Access to PC Files licensed. For the EXCEL engine also the PC File Server must be "up and running". I've got the Access module licensed but I haven't the PC File Server running - and in this situation I get exactly the same error than you do.

 

The correct syntax for the EXCEL engine appears to be: libname s excel path="<your path>"; 

I would also use the suffix ".xlsx" and not ".xls".

 

What SAS version are you on?

Does it work for you with the "path" syntax?

Is SAS/Access to PC Files installed?

Is the PC File Server running?

 

Below link doesn't include the latest XLSX engine but else covers pretty much all the options you have to create your Excel file.

http://blogs.sas.com/content/sasdummy/2012/02/11/export-excel-methods/

 

 

zay
Calcite | Level 5 zay
Calcite | Level 5

Thanks Patrick.

 

What SAS version are you on?
- SAS 9.3 (32)
Note: OS - 64-bit

proc import/export using path .xlxs works for me, but the codes above got an error: class not registered.

I've run SASKiwi codes:
proc setinit noalias; run;
Log shows the expiration date of the SAS Sytems (that maybe installed in my computer).

Is the PC File Server running?
- I don't know if this is running.

Patrick
Opal | Level 21

Then it appears you have a solution for writing an Excel.

 

The error message could be a bit more descriptive but I'm pretty sure that the error you're getting is caused by a SAS component not being installed or configured and started. Most likely it's the PC File Server (which comes as part of SAS/Access to PC Files but needs post-installation configuration to work)

zay
Calcite | Level 5 zay
Calcite | Level 5
Thanks @Patrick and @SASKiwi.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 11 replies
  • 6581 views
  • 0 likes
  • 3 in conversation