自动调用宏%mdsecds()生成语法错误

时间:2016-03-11 17:01:39

标签: sas sas-metadata

根据documentationmdsecds宏会生成一系列数据集,显示应用于每个元数据对象的权限级别。

我们将此数据加载到数据库中,以允许向下钻取(通过Web应用程序)以发现任何元数据对象的细粒度权限。

以下工作正常,直到昨天:

%mdsecds()

但现在我们得到:

MPRINT(MDSECTR):   proc transpose data=work.mdsecds_permsl out=work.mdsecds_permsw(drop=_name_);
MPRINT(MDSECTR):   by objname objuri identitydispname identityname identitytype;
MPRINT(MDSECTR):   id permission;
MPRINT(MDSECTR):   var authorization;
MPRINT(MDSECTR):   run;

NOTE: There were 4929844 observations read from the data set WORK.MDSECDS_PERMSL.
NOTE: The data set WORK.MDSECDS_PERMSW has 827938 observations and 20 variables.
NOTE: Compressing data set WORK.MDSECDS_PERMSW decreased size by 78.40 percent. 
      Compressed is 11921 pages; un-compressed would require 55197 pages.
NOTE: PROCEDURE TRANSPOSE used (Total process time):
      real time           36.12 seconds
      cpu time            35.15 seconds


MPRINT(MDSECDS):  ;
MPRINT(MDSECVW):   proc sql;
NOTE: Simple index objuri has been defined.
NOTE: Composite index users has been defined.
NOTE: Simple index objuri has been defined.
NOTE: Composite index name has been defined.
NOTE 137-205: Line generated by the invoked macro "MDSECVW".
18         (location, objname, publictype, ObjId);           create view &targdata as          select &objcols, &trancols from
                                                                                                                          ____
                                                                                                                          22
18       ! &trandata a inner join &objdata b on a.objuri=b.objuri             order by location, objname, publictype, objid,
18       ! identityname,
ERROR 22-322: Syntax error, expecting one of the following: a name, ;, (, ',', ANSIMISS, AS, CROSS, EXCEPT, FULL, GROUP, HAVING, 
              INNER, INTERSECT, JOIN, LEFT, NATURAL, NOMISS, ORDER, OUTER, RIGHT, UNION, USING, WHERE.  

NOTE: Line generated by the invoked macro "MDSECVW".
18         (location, objname, publictype, ObjId);           create view &targdata as          select &objcols, &trancols from
                                                                                                                          ____
                                                                                                                          76
18       ! &trandata a inner join &objdata b on a.objuri=b.objuri             order by location, objname, publictype, objid,
18       ! identityname,
ERROR 76-322: Syntax error, statement will be ignored.

NOTE: Line generated by the macro variable "TRANCOLS".
18          a.identitydispname, a.identityname, a.identitytype, a.CheckInMetadata, a.ReadMetadata, a.WriteMetadata, a.Administer,
18       ! a.Create, a.Delete, a.Read, a.Write, a.WriteMemberMetadata, a.Alter Table, a.Create Table, a.Drop Table, a.Insert,
                                                                               _____
                                                                               22
18       ! a.Select, a.Update
MPRINT(MDSECVW):   create index objuri on work.mdsecds_permsw(objuri) create index users on work.mdsecds_permsw(objuri, 
identitydispname, identityname, identitytype) create index objuri on work.mdsecds_objs(objuri) create index name on 
work.mdsecds_objs(location, objname, publictype, ObjId) create view work.mdsecds_join as select b.ObjId, b.ObjName, b.Location, 
b.MetadataType, b.PublicType, b.Desc, b.ParentObjId, b.MetadataCreated, b.MetadataUpdated, b.ObjUri, b.Permissions, 
a.identitydispname, a.identityname, a.identitytype, a.CheckInMetadata, a.ReadMetadata, a.WriteMetadata, a.Administer, a.Create, 
a.Delete, a.Read, a.Write, a.WriteMemberMetadata, a.Alter Table, Table, a.Drop Table, a.Insert, a.Select, a.Update from a inner 
join work.mdsecds_objs b on a.objuri=b.objuri order by location, objname, publictype, objid, identityname, identitytype;
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, *, **, +, ',', -, /, <, <=, <>, =, >, >=, ?, AND, AS, 
              CONTAINS, EQ, EQT, FROM, GE, GET, GT, GTT, LE, LET, LIKE, LT, LTT, NE, NET, OR, ^=, |, ||, ~=.  

NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
MPRINT(MDSECVW):   quit;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
      real time           17.54 seconds
      cpu time            23.78 seconds

看起来发现类似的问题here,但提供文件夹是不可接受的,因为我们想要所有元数据对象。

代码使用管理员帐户通过EG 5.1(SAS 9.3 Windows平台)运行(因此能够访问所有元数据,不会生成其他错误/警告)。

错误的可能原因是什么?

2 个答案:

答案 0 :(得分:3)

严格看待这一点。

a.Alter Table, a.Create Table, a.Drop Table,

看起来这些名称应该是名字文字。

a.'Alter Table'n, a.'Create Table'n, a.'Drop Table'n,

假设这就是问题,那么问题仍然是如何实现这一目标。

答案 1 :(得分:0)

受@ data _null_的启发,我添加了以下内容:

options validvarname=v7;

它有效!鉴于EG使用options validvarname=ANY default,必须发送内部自动调用宏。

供参考,供其他人通过夜间将此宏的结果存储在数据库中 批量,您可能还认为列级权限数据比需要的多一点(在我们的案例中,我们说的是数百万条记录,而且我们并不是那么大的商店)..请参阅下面的内容调整将忽略列(并提供更快的结果):

options validvarname=v7;
%mdsecds(memberfilter="@MetadataType ne 'Column'");