SAS Base (58)

The following program is submitted:

proc format;
value salfmt. 0 -< 50000 = ‘Less than 50K’ 50000 – high = ’50K or Greater’;

options fmterr nodate pageno=1;
title ‘Employee Report’;

proc print data=work.employees noobs;
var fullname salary hiredate;
format salary salfmt. hiredate date9.;
label fullname=’Name of Employee’ salary=’Annual Salary’ hiredate=’Date of Hire’;

Why does the program fail?

A. The PAGENO option is invalid in the OPTIONS statement.
B. The RUN statement is missing after the FORMAT procedure.
C. The format name contains a period in the VALUE statement.
D. The LABEL option is missing from the PROC PRINT statement.

Check Answer
Answer: C

注解:When defining custom formats, the name of formats cannot end in a number or a period. The name, ‘salfmt.’, in VALUE statement is invalid. However, when you refer to the custom format, the ending period is necessary.

SAS Base (34)

A user-defined format has been created using the FORMAT procedure.How is it stored?
A. in a SAS catalog
B. in a memory resident lookup table
C. in a SAS dataset in the WORK library
D. in a SAS dataset in a permanent SAS data library

Check Answer
Answer: A

注解:存储自定义FORMAT的文件格式叫作catalog。FORMAT的存储位置和名字可以通过PROC FORMAT statement中的LIBRARY option设定,缩写为LIB,格式为:LIBRARY = lebref.catalog_name。例如:
PROC FORMAT LIBRARY = SASLIB.self_defined_format;
会在SASLIB library中建立名为self_defined_format的catalog。如果不定义libref,默认library为WORK 。如果不定义catalog_name,默认名字为Formats。如果不设置LIBRARY option,FORMAT会存储在WORK library下,文件名为Formats。