SAS Chapter 7: Creating And Applying User-defined Formats

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Moxleyv
M
Moxleyv
Community Contributor
Quizzes Created: 38 | Total Attempts: 20,919
Questions: 10 | Attempts: 378

SettingsSettingsSettings
SAS Quizzes & Trivia

Practice for the SAS basic certification exam.


Questions and Answers
  • 1. 

    If you don't specify the LIBRARY= option, your formats are stored in Work.Formats, and they exist ...

    • A.

      Only for the current procedure.

    • B.

      Only for the current DATA step.

    • C.

      Only for the current SAS session

    • D.

      Permanently.

    Correct Answer
    C. Only for the current SAS session
    Explanation
    If you do not specify the LIBRARY= option, formats are stored in a format catalog named Work.Formats. As the libref Work, implies, any format that is stored in Work.Formats is a temporary format that exists only for the current SAS session.

    Rate this question:

  • 2. 

    Which of the following statements will store your formats in a permanent catalog?

    • A.

      Libname library 'c:\sas\formats\lib'; proc format lib=library       ...;

    • B.

      Libname library 'c\sas\formats\lib'; format lib=library      ...;

    • C.

      Library='c:\sas\formats\lib'; proc format library      ...;

    • D.

      Library='c:\sas\format\lib'; proc library      ...;

    Correct Answer
    A. Libname library 'c:\sas\formats\lib'; proc format lib=library       ...;
    Explanation
    To store formats in a permanent catalog, you first write a LIBNAME statement to associate the libref with the SAS data library in which the catalog will be stored. Then add the LIB= (or LIBRARY=) option to the PROC FORMAT statement, specifying the name of the catalog.

    Rate this question:

  • 3. 

    When creating a format with the VALUE statement, the format's new name
    • cannot end with a number
    • cannot end with a period
    • cannot be the name of a SAS format, and...

    • A.

      Cannot be the name of a data set variable.

    • B.

      Must be at least two characters long.

    • C.

      Must be at least eight characters long.

    • D.

      Must begin with a dollar sign ($) if used with a character variable.

    Correct Answer
    D. Must begin with a dollar sign ($) if used with a character variable.
    Explanation
    The name of a format that is created with a VALUE statement must begin with a dollar sign ($) if it applies to a character variable.

    Rate this question:

  • 4. 

    Which of the following FORMAT procedures is written correctly?

    • A.

      Proc format lib=library      value colorfmt;            1='Red'            2='Green'            3='Blue' run;

    • B.

      Proc format lib=library;      value colorfmt            1='Red'            2='Green'            3='Blue'; run;

    • C.

      Proc format lib=library;      value colorfmt;            1='Red'            2='Green'            3='Blue' run;

    • D.

      Proc format lib=library;      value colorfmt            1='Red';            2='Green';            3='Blue'; run;

    Correct Answer
    B. Proc format lib=library;      value colorfmt            1='Red'            2='Green'            3='Blue'; run;
    Explanation
    A semicolon is needed after the PROC FORMAT statement. The VALUE statement begins with the keyword VALUE and ends with a semicolon after all the labels have been defined.

    Rate this question:

  • 5. 

    Which of these is false?  Ranges in the VALUE statement can specify... 

    • A.

      A single value such as 24 or 's'.

    • B.

      A range of numeric values, such as 0-1500.

    • C.

      A range of character values, such as 'A'-'M'.

    • D.

      A list of numeric and character values separated by commas, such as 90,'B','D',270.

    Correct Answer
    D. A list of numeric and character values separated by commas, such as 90,'B','D',270.
    Explanation
    You can list values separated by commas, but the list must contain either all numeric or character.

    Rate this question:

  • 6. 

    How many characters can be used in a label?

    • A.

      40

    • B.

      96

    • C.

      200

    • D.

      256

    Correct Answer
    D. 256
    Explanation
    When specifying a label, enclose it in quotation marks and limit the label to 256 characters.

    Rate this question:

  • 7. 

    Which keyword can be used to label missing numeric values as well as any values that are not specified in the range?

    • A.

      LOW

    • B.

      MISS

    • C.

      MISSING

    • D.

      OTHER

    Correct Answer
    D. OTHER
    Explanation
    MISS and MISSING are invalid keywords, and LOW does not include missing numeric values. The keyword OTHER can be used in the VALUE statement to label missing values as well as any values that are not specifically included in a range.

    Rate this question:

  • 8. 

    You can place the FORMAT statement in either a DATA step or a PROC step.  What happens when you place it in a DATA step?

    • A.

      You temporarily associate the formats with variables.

    • B.

      You permanently associate the formats with variables.

    • C.

      You replace the original data with the format labels.

    • D.

      You make the formats available to other data sets.

    Correct Answer
    B. You permanently associate the formats with variables.
    Explanation
    By placing the FORMAT statement in a DATA step, you permanently associate the defined format with variables.

    Rate this question:

  • 9. 

    The format JOBFMT was created in a FORMAT procedure.  Which FORMAT statement will apply to the variable JobTitle in the program output?

    • A.

      Format jobtitle jobfmt;

    • B.

      Format jobtitle jobfmt.;

    • C.

      Format jobtitle=jobfmt;

    • D.

      Format jobtitle='jobfmt';

    Correct Answer
    B. Format jobtitle jobfmt.;
    Explanation
    To associate a user-defined format with a variable, place a period at the end of the format name when it is used in the FORMAT statement.

    Rate this question:

  • 10. 

    Which keyword, when added to the PROC FORMAT statement, will display all the formats in your catalog?

    • A.

      CATALOG

    • B.

      LISTFMT

    • C.

      FMTCAT

    • D.

      FMTLIB

    Correct Answer
    D. FMTLIB
    Explanation
    Adding the keyword FMTLIB to the PROCFORMAT statement displays a list of all the formats in your catalog, along with descriptions of their values

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 22, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Jan 21, 2013
    Quiz Created by
    Moxleyv

Related Topics

Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.