Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Excel 用于从元数据中列出所有SAS服务器用户的SAS脚本_Excel_Sas_Admin_Administration_Sas Metadata - Fatal编程技术网

Excel 用于从元数据中列出所有SAS服务器用户的SAS脚本

Excel 用于从元数据中列出所有SAS服务器用户的SAS脚本,excel,sas,admin,administration,sas-metadata,Excel,Sas,Admin,Administration,Sas Metadata,我需要一种方法将所有SAS用户的列表从SAS元数据导入Excel工作表。我正在考虑使用用于Microsoft Office的SAS插件创建一个动态数据源,从SAS服务器动态检索用户列表。如果我要这样做,我需要知道如何在SAS代码中这样做 是否有人知道我将如何编写SAS脚本以在SAS元数据中显示所有用户的列表,或者这是否可行 我一直想在网上找到一些东西,但运气不好 我有完全的管理员权限,所以没有问题 谢谢 感谢Joe的评论,我找到了我需要的答案: 我使用了本页的最后一个示例,修改为执行PROC打

我需要一种方法将所有SAS用户的列表从SAS元数据导入Excel工作表。我正在考虑使用用于Microsoft Office的SAS插件创建一个动态数据源,从SAS服务器动态检索用户列表。如果我要这样做,我需要知道如何在SAS代码中这样做

是否有人知道我将如何编写SAS脚本以在SAS元数据中显示所有用户的列表,或者这是否可行

我一直想在网上找到一些东西,但运气不好

我有完全的管理员权限,所以没有问题


谢谢

感谢Joe的评论,我找到了我需要的答案:

我使用了本页的最后一个示例,修改为执行PROC打印,而不是导出到Excel工作表。在《企业指南》中,我创建了一个新计划,如下所示:

/*Connect to the metadata server using the metadata system options as 
shown in the first example. */

data work.Identities;

/* The LENGTH statement defines the lengths of variables for function arguments. */
length IdentId IdentName DispName ExtLogin IntLogin DomainName $32 
uri uri2 uri3 uri4 $256;

/* The LABEL statement assigns descriptive labels to variables. */
label
    IdentId    = "Identity Id"
    IdentName  = "Identity Name"
    DispName   = "Display Name"
    ExtLogin   = "External Login"
    IntLogin   = "Is Account Internal?"
    DomainName = "Authentication Domain";

/* The CALL MISSING statement initializes the output variables to missing values. */
call missing(IdentId, IdentName, DispName, ExtLogin, IntLogin, DomainName, 
uri, uri2, uri3, uri4);
n=1;
n2=1;

/* The METADATA_GETNOBJ function specifies to get the Person objects in the repository. 
The n argument specifies to get the first person object that is returned. 
The uri argument will return the actual uri of the Person object. The program prints an 
informational message if no objects are found. */

rc=metadata_getnobj("omsobj:Person?@Id contains '.'",n,uri);
if rc<=0 then put "NOTE: rc=" rc
"There are no identities defined in this repository" 
" or there was an error reading the repository.";

/* The DO statement specifies a group of statements to be executed as a unit. 
The METADATA_GETATTR function gets the values of the Person object's Id, Name, 
and DisplayName attributes. */
do while(rc>0); 
    objrc=metadata_getattr(uri,"Id",IdentId);
    objrc=metadata_getattr(uri,"Name",IdentName); 
    objrc=metadata_getattr(uri,"DisplayName",DispName);

/* The METADATA_GETNASN function gets objects associated via the
InternalLoginInfo association. The InternalLoginInfo association returns
internal logins. The n2 argument specifies to return the first associated object
for that association name. The URI of the associated object is returned in
the uri2 variable. */

objrc=metadata_getnasn(uri,"InternalLoginInfo",n2,uri2);

/* If a Person does not have any internal logins, set their IntLogin
variable to 'No' Otherwise, set to 'Yes'. */
IntLogin="Yes";
DomainName="**None**";
if objrc<=0 then
do;
put "NOTE: There are no internal Logins defined for " IdentName +(-1)".";
IntLogin="No";
end;

/* The METADATA_GETNASN function gets objects associated via the Logins association. 
The Logins association returns external logins. The n2 argument specifies to return 
the first associated object for that association name. The URI of the associated 
object is returned in the uri3 variable. */

objrc=metadata_getnasn(uri,"Logins",n2,uri3);

/* If a Person does not have any logins, set their ExtLogin
variable to '**None**' and output their name. */
if objrc<=0 then
do;
put "NOTE: There are no external Logins defined for " IdentName +(-1)".";
ExtLogin="**None**";
output;
end;

/* If a Person has many logins, loop through the list and retrieve the name of 
each login. */
do while(objrc>0);
objrc=metadata_getattr(uri3,"UserID",ExtLogin);

/* If a Login is associated to an authentication domain, get the domain name. */
DomainName="**None**";
objrc2=metadata_getnasn(uri3,"Domain",1,uri4);
if objrc2 >0 then
do;
 objrc2=metadata_getattr(uri4,"Name",DomainName);
end;

/*Output the record. */
output;

n2+1;

/* Retrieve the next Login's information */
objrc=metadata_getnasn(uri,"Logins",n2,uri3);
end; /*do while objrc*/

/* Retrieve the next Person's information */
n+1;
n2=1;

rc=metadata_getnobj("omsobj:Person?@Id contains '.'",n,uri);
end; /*do while rc*/

/* The KEEP statement specifies the variables to include in the output data set. */
keep IdentId IdentName DispName ExtLogin IntLogin DomainName; 
run;

/* The PROC PRINT statement writes a basic listing of the data. */
proc print data=work.Identities label;
run;

/* The PROC EXPORT statement can be used to write the data to an Excel spreadsheet. */
/* Change DATA= to the data set name you specified above. */
/* Change OUTFILE= to an appropriate path for your system. */
/*
proc export data=work.Identities 
    dbms=EXCE 
    outfile="C:\temp\Identities.xls"
    replace;
run;
*/

PROC PRINT DATA=work.Identities;
/*使用以下元数据系统选项连接到元数据服务器:
如第一个示例所示*/
数据工作。身份;
/*LENGTH语句定义函数参数的变量长度*/
长度IdentId IdentName DispName ExtLogin IntLogin域名$32
uri uri2 uri3 uri4$256;
/*LABEL语句为变量指定描述性标签*/
标签
IdentId=“Identity Id”
IdentName=“Identity Name”
DispName=“显示名称”
ExtLogin=“外部登录”
IntLogin=“帐户是内部帐户吗?”
DomainName=“验证域”;
/*CALL MISSING语句将输出变量初始化为缺少的值*/
调用丢失(IdentId、IdentName、DispName、ExtLogin、IntLogin、DomainName、,
uri,uri2,uri3,uri4);
n=1;
n2=1;
/*METADATA_GETNOBJ函数指定获取存储库中的Person对象。
n参数指定获取返回的第一人称对象。
uri参数将返回Person对象的实际uri。该程序打印一个
如果未找到任何对象,则显示信息性消息*/
rc=metadata_getnobj(“omsobj:Person?@Id包含“.”,n,uri);

如果rc如果您只想提取SAS中的用户列表,可以编译并运行:


免责声明-我写的,我们在我们的商业产品()中使用它,这样用户在应用工具权限时可以看到组成员身份。

看起来您可以查看文档以获取此信息-例如,ie。谢谢!页面末尾的示例(“列出用户及其登录名”)就是我所需要的。你应该把它作为一个答案,这样你就得到了荣誉。我真的不太理解它作为一个答案-如果你足够理解它,请这样做。(仅仅是一个链接并不是一个好的答案-答案应该说明如果链接在将来断开,如何充分做到这一点)。仅供参考-我已经意识到报告不会自动更新。我认为这在SAS 9.4之前是不可能的,那时你可以将代码嵌入到Office文档中。有什么好的理由可以解释为什么该程序没有直接创建数据集的OUT=选项?除了较新的SAS开发人员之外,其他开发人员不了解SAS是如何工作的?
%mm_getusers(outds=myusers)