2.4 Flashcards
True/False - SAS formats are used to specify how data values are displayed.
True
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
d) The ‘Below Average’ range includes values up to, but not including 58.
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) OTHER
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
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.
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;
proc format cntlin=work.sbdata;
run;
True/False - By default, custom formats are stored in a permanent SAS library after they are created.
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;
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) 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.
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.
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.
Which of the following is NOT a keyword that can be used in the VALUE statement?
a) LOW
b) MIDDLE
c) HIGH
d) OTHER
b) MIDDLE
True/False - The CNTLIN= option specifies the library where a permanent SAS format is stored.
False - The CNTLIN= option specifies a table from which PROC FORMAT builds formats.
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’;
b) value qtrfmt 1,2,3=’First’
4,5,6=’Second’;
What is the formatted value for the value of 100 given the following step?
proc format;
value rates 1-<100 = ‘low’
100
d) out of range
100 falls in the OTHER category. 1-<100 is less than 100. 100
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.
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.
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
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.
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.
d) The CNTLIN= option specifies a table from which formats are built.