Unlike BASE SAS tables, OLAP cubes must exist in within the metadata in order to access from any of the OLAP Viewers. In addition to having some metadata OLAP cubes have a physical file structure presence (at least for MOLAP/HOLAP because it's a different story for ROLAP). When you refresh these cubes, the physical file structure is scrapped and recreated. If something goes horrible wrong, the metadata remains but the files are simply ... gone.
But what can you do to check whether it was successful during batch processing? Fortunately, SAS users are sharers. A quick Google search on my custom Google search engine resulted in this SAS Community post on checking to see if a directory exists. You can use this outright, or if you don't have the path handy you can search through the metadata using data step functions and run the whole thing with only the cube name as input.
/*Specify the cube name*/ %let cubename = SalesSummary; /*Use the Data Step Interface to Metadata*/ data _null_; length path cubeuri diruri $256; path=""; cubeuri=""; diruri=""; /* Find the CubeURI*/ rc2=metadata_getnasn("omsobj:Cube?@Name='&cubename'","AssociatedFile",1,cubeuri); /* Find the Directory URI*/ rc3=metadata_getnasn(cubeuri,"Directories",1,diruri); /* Retrieve the DirectoryName Value*/ rc4=metadata_getattr(diruri,"DirectoryName",path); call symput('path', strip(path)); run; /*Set the SASCommunity.org Macro*/ %macro DirExist(dir) ; %LOCAL rc fileref return; %let rc = %sysfunc(filename(fileref,&dir)) ; %if %sysfunc(fexist(&fileref)) %then %let return=1; %else %let return=0; &return %mend DirExist; /*Determine if the physical path exists*/ %put %DirExist(&path\&cubename\gen0000);
If it returns a 0, you know that the refresh code failed and there is no data there. You could use this to send an alert or to move to a different phase of the process. What would you do with this code? What other uses can you think of?