AMLG

 找回密码
 立即注册
查看: 679|回复: 0

[sas] SAS Library Information: Formats_SAS培训

[复制链接]

1万

主题

1万

帖子

3万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
39054
发表于 2016-12-9 13:24:09 | 显示全部楼层 |阅读模式
SAS Library Information: Formats,
The old way: Create a PROC FORMAT control data set,
The original approach is to apply PROC FORMAT to a format catalog to create an output data set. The resulting range-level information will be collapsed to the format level in a subsequent step.,
proc format;,
value tempnum,
other=”Temporary Numeric Format”;
run;
libname dinomain “C:\temp\dinosaur”;
proc format library=dinomain cntlout=MainFormats(keep=FmtName Type);
run;
proc format library=work cntlout=WorkFormats(keep=FmtName Type);
run;
data Formats;
length LibraryName $ 8;
retain CatalogName “FORMATS”;
set MainFormats(in=inMain) WorkFormats(in=inWork);
if inMain then LibraryName=”DINOMAIN”;
else if inWork then LibraryName=”WORK”;
run;
proc sort data=Formats nodupkey;
by LibraryName CatalogName FmtName Type;
run;
proc print data=Formats label;
var LibraryName CatalogName FmtName Type;
label FmtName=”Format Name” Type=”Format Type”;
title1 “Formats Stored in Multiple Libraries”;,
run;,
The new way: Reference DICTIONARY.CATALOGS in PROC SQL
(available in SAS Version 6)
,
An alternate approach is to use the dictionary tables feature of PROC SQL which permits access to metadata related to SAS catalogs accessible in a SAS session. A single query can extract the desired format names from the DICTIONARY.CATALOGS dictionary table.,
proc format;
value tempnum
other=”Temporary Numeric Format”;
run;
libname dinomain “C:\temp\dinosaur”;
proc sql;
create table Formats as
select Libname,
Memname label=”Catalog Name”,
Objname label=”Format Name”,
case
when(Objtype=”FORMATC”) then “C”
else “N”
end as Type label=”Format Type”
from DICTIONARY.CATALOGS
where Objtype like “FORMAT%”
and Libname in (“DINOMAIN”,”WORK”)
order by Libname, Type, Memname;
quit;
proc print data=Formats label;
var Libname Memname ObjName Type;
title1 “Formats Stored in Multiple Libraries”;
run;,
转载请注明:数据分析 » SAS Library Information: Formats_SAS培训
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

AMLG ( 赣ICP备16006919-2号 )

GMT+8, 2020-7-3 00:53 , Processed in 0.089869 second(s), 27 queries .

快速回复 返回顶部 返回列表