Building Cubes and Administering Cubes |
The OLAP procedure is one of the SAS tools that you can use to create, update, and delete cubes. It provides statements that enable you to add dimensions, levels, hierarchies, measures and aggregations to a cube as it is being created. These statements, when combined with the PROC OLAP statement and METASVR statement, are often referred to as the long form of PROC OLAP. The long form of PROC OLAP is used when there is no metadata definition for a cube in the SAS metadata. When submitted, the long form of the procedure first creates the metadata definition of the cube in the SAS metadata and then creates the physical files for the cube. If a metadata definition for the cube specified on the PROC OLAP statement already exists, an error message is printed in the log.
In addition to basic cube creation tasks, you can use a shorter form of PROC OLAP to perform maintenance tasks on an existing cube metadata definition. The short form of PROC OLAP must include the PROC OLAP statement and the METASVR statement. Other statements, such as the DEFINE, AGGREGATION, DROP_AGGREGATION and UNDEFINE statements can also be included, depending on the task you want to perform. These include the following:
delete the physical files for the cube while leaving the metadata definition intact (PROC OLAP with the DELETE_PHYSICAL option and METASVR statements)
create the physical files for the cube based on the information in the existing metadata definition (PROC OLAP and METASVR statements)
define new calculated members for a cube or remove existing calculated members (PROC OLAP, METASVR and DEFINE or UNDEFINE statements)
define new aggregations or delete existing aggregations (PROC OLAP, METASVR, AGGREGATION or DROP_AGGREGATION statements)
You can use SAS OLAP Cube Studio to modify the metadata definition of a cube and then use the short form of PROC OLAP to rebuild the cube, including the changes. For example, if you want to add a dimension to an existing cube, edit the cube structure in SAS OLAP Cube Studio to add the dimension. Then, from the Finish panel of the Cube Designer, submit the short form of PROC OLAP to delete the physical files for the cube, save the changes to the metadata for the cube, and then submit the short form of PROC OLAP to re-create the physical files. An advantage to using the short form in this fashion is that links to access control entries, information maps, and reports will not be broken as the cube is updated.
To accomplish the same task using the long form of PROC OLAP, you would still use the short form with the DELETE option to delete the physical cube files and to delete the metadata definition. The appropriate DIMENSION statements would be added to the long form and the code submitted to create the new metadata and the new physical files. But now the access controls for the cube would need to be re-created and information maps and reports would need to be adjusted to account for the newly created cube.
Export Code |
The Export Code function is available in SAS OLAP Cube Studio. The Export Code function enables you to store in a text file the PROC OLAP code that is used to edit or build the cube. There are two options to exporting the PROC OLAP code: the long form or the short form. The Export Code dialog box appears when you perform one of these steps:
Click Export Code on the Finish page in the Cube Designer wizard. | |
Select Export Code from the Actions menu. |
On the Export Code dialog box, you can select one of the following options:
Long form - enables you to save the full version of the OLAP procedure code to a text file.
Short form - enables you to save the short version of the OLAP procedure code to a text file.
The Export Code function is also available from the Aggregation Tuning and Incremental Update functions. When accessed from these functions, the text file that is generated contains the short form of PROC OLAP.
For both the long form and short form options, enter a fully qualified path, including file extension, to the location for the text file. The text file that is created stores the PROC OLAP code that is used to create the currently selected cube. Use the Browse button to navigate to a location on the file system. You can also open the drop-down box for either the long or short form options. SAS OLAP Cube Studio maintains a record of the five most recently used files for you to select from. The most recently used file is at the top of the list.
The PROC OLAP code that is generated can contain MDX expressions. If the MDX expression contains mixed quotation marks (both single and double quotes), do not place quotation marks around the MDX string. You must resolve this issue before submitting the PROC OLAP code. When working with quotation marks follow these guidelines:
If the MDX string contains only single quotation marks, then place double quotation marks around the MDX string.
If the MDX string contains only double quotation marks, then place single quotation marks around the MDX string.
Note: The PROC OLAP code that is generated by the Export Code function does not include the user ID and password due to security reasons. You must manually add the user ID and password to the exported file before submitting.
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.