DATA Step, Macro, Functions and more

checking if olap cube exist

Posts: 48

checking if olap cube exist

Need some help with olaps.

My code creates OLAP cube.
Before it creates OLAP cube it deletes it.
Everything is ok, when cube already exists.
When it doesn't exist error is generated like:
ERROR: The registration for cube TESTCUBE was not found on the metadata server.
it also makes macro variable syscc ne 0.

So i want to insert some "if-then" statement, which checks if cube already exists.
Anyone knows how to do that.

P.s. SBB don't bother suggesting searching for google or SAS sites. I had already done that.
Super Contributor
Super Contributor
Posts: 3,176

Re: checking if olap cube exist

Given the statement: "My code"....

Suggest you share your code, ideally embedded in a SAS-generated log output to help forum readers to visualize / understand what your code is doing.

Scott Barry
SBBWorks, Inc.
Not applicable
Posts: 0

Re: checking if olap cube exist

try using "exist" function.
Posts: 9,365

Re: checking if olap cube exist

Also useful to know would be these things:
1) Are you using OLAP cubes within the context of the BI Platform (also known as the SAS Platform for Business Analytics)???
2) Are you using a DI Studio job to build your OLAP cube?
3) Are you using code generated in OLAP Cube Studio to build your cube?
4) If you are using the BI Platform, do you have access to view the metadata definitions via SAS Management Console????
5) If you are not directly using the SAS BI Platform or DI Studio and/or OLAP cube studio, are you perhaps using a product called Futrix and using OLAP cubes under that context????

Finally, this is probably not the best forum to post OLAP questions. You may find some OLAP cube users/builders here, but most OLAP cubes these days are used/built/maintained under the context of the BI Platform and most of those folks can be found in the Web Report Studio forum.

As for Googling to find out more information, the documentation for PROC OLAP is here (with examples):

Posts: 48

Re: checking if olap cube exist

Posted in reply to Cynthia_sas

I am using SAS code like, which can be generated from OLAP Cube Studio.
The code is submited in SAS batch mode.

I don't understand why the code is needed? I ask how to check if cube exist, you ask me, how i create cubes.

The question is simple if there is any way, how to check if cube exist. It must be done with sas datastep functions.
More detail question is:
How to check if cube exist (is registered) on metadata server?

Ok, i also try to ask the same question in web report Studio.


exist function is for datasets/views/catalogs not for olap cube.
Posts: 9,365

Re: checking if olap cube exist

The way to check whether a cube exists might NOT be as simple as you suppose. It might NOT happen with Base SAS or Foundation SAS datastep functions. I believe you have to make a call to the metadata repository to check the existence of a cube.

For example, as you found out, the EXIST function checks for the existence of a SAS library member and your OLAP cube (depending on your configuration) may not be known by a library location, but instead might be known by a metadata repository location. Since this forum is for mostly "Base SAS" and Display Manager folks, there's not as much awareness of BI Platform maintenance issues or BI-related procedures.

If you want to check the existence of metadata objects, then I believe the way to do that is through the use of calls to the metadata using the special DATA step functions designed for use with metadata objects, as described here:

For more specific help with these datastep functions, you might want to open a track with SAS Tech Support.

Posts: 48

Re: checking if olap cube exist

Posted in reply to Cynthia_sas
Thank you, Cynthia,

Yes, using these functions, and a help from some resources i managed to check if cube exist.
Of course first we have to place so metadata options.
The example is here:

data _null_;
put uri;
Ask a Question
Discussion stats
  • 6 replies
  • 4 in conversation