2.4 Flashcards

1
Q

True/False - SAS formats are used to specify how data values are displayed.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which of the following are true regarding the SAS format hrange specified in the PROC FORMAT step below?

proc format;
value hrange low-<58 = ‘Below Average’
58-60 = ‘Average
60

A

d) The ‘Below Average’ range includes values up to, but not including 58.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What keyword can you use in a PROC FORMAT step to specify all values other than the ones already specified?

a) OTHER
b) ELSE
c) EITHER
d) None of the above

A

a) OTHER

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

When you use an input table to create a format, the table must have a particular structure with at least three specific columns. Which of the below is NOT a column needed?

a) FmtName
b) Start
c) Label
d) Range

A

d) Range

The column named FmtName contains the name of the format you are creating. If you’re creating a format to apply to character values, the name must begin with a dollar sign. The column named Start contains the values to the left of the equal sign in the VALUE statement. The column named Label contains the values to the right of the equal sign in the VALUE statement. You might need additional columns, for example, if you’re specifying ranges you need an End column in addition to a Start column.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q
Which of the following is correct syntax for creating a format from a table?
a) proc format cntlin=work.sbdata;
run;
b)proc format;
    cntlin=work.sbdata;
run;
e) proc format;
          values = cntlin / work.sbdata;
    run;
A

proc format cntlin=work.sbdata;

run;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

True/False - By default, custom formats are stored in a permanent SAS library after they are created.

A

False - By default, custom formats are stored in the temporary Work library in a catalog named Formats.

To create a permanent custom format, you must specify where they are stored. You can use the LIBRARY=, or LIB= option to specify a library and a catalog name:

proc format library = pg2.myfmts;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Once you create a permanent custom format, what else is needed in order to use it?

a) If the format is not in a library named LIBRARY, you must use the global OPTIONS statement with FMTSEARCH= option to tell SAS where to find the format.
b) You must specify the proc format step that creates the permanent library at the beginning of each program.
c) You only need to specify the format statement in the procedure or data step where you want it applied.

A

a) If the format is not in a library named LIBRARY, you must use the global OPTIONS statement with FMTSEARCH= option to tell SAS where to find the format.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Which of the following is NOT true regarding custom SAS formats?

a) A VALUE statement specifies the criteria for creating one custom format.
b) Multiple VALUE statements can be used in the PROC FORMAT step.
c) The format name can be up to 32 characters in length, must begin with a $ followed by a letter or underscore for character formats, and must begin with a letter or underscore for numeric formats.
d) In the VALUE statement the left side of the equal sign are always enclosed in quotation marks.

A

d) Character values must be in quotation marks; numeric values are not quoted.

On the right side of the equal sign, you specify the formatted values that you want the values on the left side to become. Formatted values need to be in quotation marks.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Which of the following is NOT a keyword that can be used in the VALUE statement?

a) LOW
b) MIDDLE
c) HIGH
d) OTHER

A

b) MIDDLE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

True/False - The CNTLIN= option specifies the library where a permanent SAS format is stored.

A

False - The CNTLIN= option specifies a table from which PROC FORMAT builds formats.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Which of the following contains valid syntax?
a) value grades ‘A’ = ‘Excellent’
‘B’ = ‘Good’;
b) value qtrfmt 1,2,3=’First’
4,5,6=’Second’;
c) value $grades. ‘A’ = ‘Excellent’
‘B’ = ‘Good’;
d) value qtrfmt ‘1’-‘3’ = ‘First’
‘4’-‘6’ = ‘Second’;

A

b) value qtrfmt 1,2,3=’First’

4,5,6=’Second’;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the formatted value for the value of 100 given the following step?
proc format;
value rates 1-<100 = ‘low’
100

A

d) out of range

100 falls in the OTHER category. 1-<100 is less than 100. 100

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

True/False - In the FORMAT procedure, you specify the name of the format and the name of the column that will use the custom format.

A

False - The format name is specified in the VALUE statement of PROC FORMAT. However, PROC FORMAT has no reference to the table or column to be formatted. Those items appear in other steps.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q
Which is the correct formatted output given the following PROC FORMAT step and the input table?
proc format;
    value $answer '1' = 'Yes'
                             '2' = 'No'
                              'other' = 'Not Answered';
run;
Code
1
2
3
a) Yes, No, 
b) Yes, No, Not
c) Yes, No, 3
d) Yes, No, Not Answered
A

c) Yes, No, 3
The work other is in quotation marks. Therefore, it is not seen as a keyword. A value of 3 is not referenced by any of the values in the VALUE statement. The value 3 is displayed as 3.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Which statement is true concerning options for the FORMAT procedure?

a) The FMTLIB option goes in the SELECT statement
b) The CNTLIN= option goes in the VALUE statement
c) The FMTLIB option specifies the library to store the format.
d) The CNTLIN= option specifies a table from which formats are built.

A

d) The CNTLIN= option specifies a table from which formats are built.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Which columns are required in an input table to create a format based on a numeric range?

a) FMTNAME, START, and LABEL
b) FORMAT, START, END, and NAME
c) FMTNAME, START, END, and LABEL
d) FORMAT, START, LAST, NAME, and TYPE

A

c) FMTNAME, START, END, and LABEL

At a minimum, FMTNAME, LABEL, and START are required for a CNTLIN= table. END is also needed for ranges.

17
Q

Which option in the PROC FORMAT statement specifies a library to store a custom format?

a) CATALOG=
b) FMTLIB=
c) LIBRARY=
d) STORE=

A

c) LIBRARY=

The LIBRARY= option specifies the library or catalog (or both) that contains the formats that you are creating. The FMTLIB= option creates a report containing information about your custom formats.

18
Q

What is the default search order that is used to locate formats?

a) LIBRARY.FORMATS > WORK.FORMATS
b) SASHELP.FORMATS > LIBRARY.FORMATS
c) SASHELP.FORMATS > WORK.FORMATS
d) WORK.FORMATS > LIBRARY.FORMATS

A

d) WORK.FORMATS > LIBRARY.FORMATS

By default, SAS first looks in WORK.FORMATS. If the format is not in that location, SAS looks in LIBRARY.FORMATS.

19
Q

Which of the following contains valid syntax for the FMTSEARCH= option?
a)options fmtsearch=sashelp;
b) options fmtsearch=sashelp.formats;
c) options fmtsearch(sashelp sashelp.fmts);
options fmtsearch=[sashelp.fmts sashelp];

A

c) options fmtsearch(sashelp sashelp.fmts);

The FMTSEARCH= option must specify search criteria in parenthesis. After looking in default locations, SAS looks in the SASHELP.FORMATS and then SASHELP.FMTS