Please help me with this error.
%include "E:\program\monthly.sas";
%let sum=E:\data\datamonthly_&yr._&month..xls;
%data(&yr,&month,&sum);
where monthly.sas:
%macro data(year,month,lib);
libname s "&lib";
%mend data;
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)
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";
Run: proc setinit noalias; run;
@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.
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.
@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.
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/
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.
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)
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.