SAS:如何在包含最多案例的库中找到数据集?
SAS: How to find the dataset in a library that contains the most cases?
因为一个库中包含许多数据集。我如何使用 SAS 代码找出哪个数据集具有 最大个案数 ?
假设库名是"SASHELP".
谢谢!
SQLdictionary.*
系列表提供了对各种元数据的访问权限。请注意,某些字典请求可能会导致大量 activity,因为它会收集请求的信息。
来自文档:
How to View DICTIONARY Tables
…
DICTIONARY Tables and Performance
When you query a DICTIONARY table, SAS gathers information that is pertinent to that table. Depending on the DICTIONARY table that is being queried, this process can include searching libraries, opening tables, and executing SAS views. Unlike other SAS procedures and the DATA step, PROC SQL can improve this process by optimizing the query before the select process is launched. Therefore, although it is possible to access DICTIONARY table information with SAS procedures or the DATA step by using the SASHELP views, it is often more efficient to use PROC SQL instead.
…
Note: SAS does not maintain DICTIONARY table information between queries. Each query of a DICTIONARY table launches a new discovery process.
示例:
* Use dictionary.tables to get the names of the tables with the 10 most rowcount;
proc sql;
reset outobs=10;
create table top_10_datasets_by_rowcount as
select libname, memname, nobs
from dictionary.tables
where libname = 'SASHELP'
and memtype = 'DATA'
order by nobs descending
;
reset outobs=max;
因为一个库中包含许多数据集。我如何使用 SAS 代码找出哪个数据集具有 最大个案数 ? 假设库名是"SASHELP".
谢谢!
SQLdictionary.*
系列表提供了对各种元数据的访问权限。请注意,某些字典请求可能会导致大量 activity,因为它会收集请求的信息。
来自文档:
How to View DICTIONARY Tables
…
DICTIONARY Tables and PerformanceWhen you query a DICTIONARY table, SAS gathers information that is pertinent to that table. Depending on the DICTIONARY table that is being queried, this process can include searching libraries, opening tables, and executing SAS views. Unlike other SAS procedures and the DATA step, PROC SQL can improve this process by optimizing the query before the select process is launched. Therefore, although it is possible to access DICTIONARY table information with SAS procedures or the DATA step by using the SASHELP views, it is often more efficient to use PROC SQL instead.
…Note: SAS does not maintain DICTIONARY table information between queries. Each query of a DICTIONARY table launches a new discovery process.
示例:
* Use dictionary.tables to get the names of the tables with the 10 most rowcount;
proc sql;
reset outobs=10;
create table top_10_datasets_by_rowcount as
select libname, memname, nobs
from dictionary.tables
where libname = 'SASHELP'
and memtype = 'DATA'
order by nobs descending
;
reset outobs=max;