数据价值-DataValues

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 86|回复: 0

[sas] SAS Library Information: Formats_SAS培训

[复制链接]

1万

主题

1万

帖子

3万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
39025
发表于 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培训
回复

使用道具 举报

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

本版积分规则

QQ|Archiver|手机版|小黑屋|DataValues ( 赣ICP备16006919号 ) DataValues

GMT+8, 2019-5-20 07:34 , Processed in 0.134027 second(s), 29 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

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