DATA Step, Macro, Functions and more

ERROR: Class not registered.

Accepted Solution Solved
Reply
Occasional Contributor zay
Occasional Contributor
Posts: 7
Accepted Solution

ERROR: Class not registered.

[ Edited ]

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;


Accepted Solutions
Solution
‎10-16-2015 12:37 AM
Respected Advisor
Posts: 4,173

Re: ERROR: Class not registered.

[ Edited ]

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


All Replies
Respected Advisor
Posts: 4,173

Re: ERROR: Class not registered.

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";

 

 

Occasional Contributor zay
Occasional Contributor
Posts: 7

Re: ERROR: Class not registered.

Thanks Patrick. But, how would I know if I have this (SAS/Access to PC files needs to be licensed for this to work)?
Super User
Posts: 3,256

Re: ERROR: Class not registered.

Run: proc setinit noalias; run;

Occasional Contributor zay
Occasional Contributor
Posts: 7

Re: ERROR: Class not registered.

Thanks SASKiwi.
Occasional Contributor zay
Occasional Contributor
Posts: 7

Re: ERROR: Class not registered.

[ Edited ]

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.

Super User
Posts: 3,256

Re: ERROR: Class not registered.

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.

Occasional Contributor zay
Occasional Contributor
Posts: 7

Re: ERROR: Class not registered.


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. 

Respected Advisor
Posts: 4,173

Re: ERROR: Class not registered.

[ Edited ]

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/

 

 

Occasional Contributor zay
Occasional Contributor
Posts: 7

Re: ERROR: Class not registered.

[ Edited ]

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.

Solution
‎10-16-2015 12:37 AM
Respected Advisor
Posts: 4,173

Re: ERROR: Class not registered.

[ Edited ]

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)

Occasional Contributor zay
Occasional Contributor
Posts: 7

Re: ERROR: Class not registered.

Thanks @Patrick and @SASKiwi.
🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

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