【问题标题】:SAS: Proc Olap. Non-nway aggregationSAS:Proc Olap。非nway聚合
【发布时间】:2012-07-16 08:59:38
【问题描述】:

我想做Rolap-cube

创建表后,我使用宏生成在proc olap中编写聚合语句。

看到这样的警告和错误:

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.

怎么了? (我没有指定数据集,因为我有很多表,我想在Rolap-cube 中使用)

补充: 如果我有这样的尺寸:

DIMENSION MyDim hierarchies=(First Second)

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

D是一个最小的层级,它有两个层次:D belond to B belong to AD belong to C

如果我指定带有级别的聚合表:
1) A B D
2) A B
3) A
4) C D
5) C
6)none

然后 sas 对我说,我没有指定输入数据集。 (聚合表之一)。

但是这 6 个聚合涵盖了所有可能的 detalization(没有像 A B C DA C D 这样的交叉覆盖 detalization)

【问题讨论】:

  • 您肯定必须指定(一个)输入数据集 - 表或视图
  • 怎么判断,是哪一个? (如果我有一些层次结构)

标签: sas sas-macro rolap


【解决方案1】:

PROC OLAP DATA= 选项中,您应该指定多维数据集的数据源

  1. 完整的非规范化表/视图(星型模式事实的连接和 维度表)或
  2. 只是事实表(您也可以将其称为FACT= 选项以明确)。

在情况 2 中,您还必须提供(通常是多个)DIMENSION ...; 语句,其中包含对 DIMTBL=library.tablname 选项中维度表的引用。

摘自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)

编辑:

一个维度可以有多个层次结构。它们(它们的列)必须驻留在非规范化基表中或在DIMENSION 语句中的DIMTBL= 选项中引用的一维表中。

因此,如果您使用星型模式构建多维数据集,您应该为每个维度创建一个表和一个事实表。 每个维度表都应包含定义一个或多个层次结构所需的所有列。

也就是说,在您的情况下,DIMENSION MyDim 包含在 MyLib 库中的表 MyDim 中 - 相关语句应该是:

DIMENSION MyDim hierarchies=(First Second) 
  DIMKEY=D
  DIMTBL=MyLib.MyDim
     ; 

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

【讨论】:

  • 好一个,但我想了解,如果我有两个像我的问题一样的层次结构会发生什么(现在编辑)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-07-03
  • 1970-01-01
  • 1970-01-01
  • 2021-11-07
  • 1970-01-01
相关资源
最近更新 更多