本站分享:大数据、数据分析师考试认证培训,包括:Python培训Excel培训Matlab培训SPSS培训SAS培训R语言培训Hadoop培训Amos培训Stata培训Eviews培训广告位

SAS Library Information: Formats_SAS培训

sas培训 cdadata 1515℃

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培训

喜欢 (0)or分享 (0)