sassas-macrorolap

SAS: Proc Olap. Non-nway aggregation


I want to make Rolap-cube.

After creation of tables, i use macro-generation to write Aggregation statement in proc olap.

And see warning and error like this:

WARNING: You cannot use NAME "DEFAULT" in the AGGREGATION statement for a non-NWAY   aggregation.
NOTE: The aggregation name "DEFAULT" was changed to "AGGR1".

ERROR: An input data set was not specified.

What's wrong? (i don't specified data set, cause i have a big number of tables, that i want to use in Rolap-cube)

Addition: If i have dimension like this:

DIMENSION MyDim hierarchies=(First Second)

HIERARCHY First 
     levels=(A B D)
    DEFAULT
    ;
HIERARCHY Second 
     levels=(C D)    
    ;

D is a smallest level, it has two hierarchies: D belond to B belong to A and D belong to C

If i specify AGGREGATION TABLE with levels:
1) A B D
2) A B
3) A
4) C D
5) C
6) none

then sas said to me, that i don't specify input data set. (one of the aggregation tables).

But these 6 aggregations cover all possible detalizations (there is no cross-cover detalization like A B C D or A C D)


Solution

  • In PROC OLAP DATA= option you should specify the data source for the cube

    1. either full denormalized table/view (join of star schema fact and dimension tables) or
    2. just the fact table (you can also refer to it as FACT= option to be clear).

    In case 2, you also have to provide (usually several) DIMENSION ...; statements containing reference to dimension table in DIMTBL=library.tablname option.

    Excerpt from http://support.sas.com/documentation/cdl/en/olapug/59574/HTML/default/viewer.htm#a002605625.htm

    > DATA | FACT=dsname
    > 
    >     specifies the data source for the cube. The unsummarized data source can be any SAS data file, including files that are supported by
    > SAS/ACCESS software engines. If you load the cube from a star schema,
    > then the dsname is the name of the fact table that contains the
    > analysis variables from which to derive the measures for the cube. The
    > fact table must also contain fact keys that correspond to dimension
    > tables in the star schema.
    > 
    >     You can also provide data set options along with DATA | FACT=. Options are stored within the cube and reapplied when the data is
    > accessed at run time. For more information, see "Data Set Options" in
    > SAS Language Reference: Concepts.
    > 
    >     Note:   This option is not required if you want to define the cube by using input data from a fully summarized external data source (a
    > crossing of all dimensions known as an NWAY). In that case, you
    > specify the data source for the cube by using the TABLE= option in the
    > AGGREGATION statement.  [cautionend]
    >     Interaction:  If you load the cube from a star schema, then you must use the DIMENSION statement to do the following:
    > 
    >         specify the dimension table name (the DIMTBL= option)
    > 
    >         specify the dimension (primary) key column (the DIMKEY= option)
    > 
    >         specify the column (foreign key) in the fact table that corresponds to the dimension key column (the FACTKEY= option)
    

    EDIT:

    You can have several hierarchies for one dimension. They (their columns) have to reside either in the denormalized base table or in one dimension table referenced in DIMTBL= option in DIMENSION statement.

    So if you use star schema to build the cube, you should have one table for each dimension and a fact table. Each dimension table should contain all columns required to define one or more hierarchies.

    Les's say, in your case, the DIMENSION MyDim is contained in table MyDim in library MyLib - the relevant statements should be:

    DIMENSION MyDim hierarchies=(First Second) 
      DIMKEY=D
      DIMTBL=MyLib.MyDim
         ; 
    
    HIERARCHY First 
         levels=(A B D)
        DEFAULT
        ;
    HIERARCHY Second 
         levels=(C D)    
        ;