Scenario 2

Directions

This scenario uses the Certadv.Monsal data set. Write a SAS program that does the following:
  • Use PROC FORMAT to create a numeric format that specifies a template for displaying month values.
    • If the value is 1 through 12, display the value as a two-digit number (month values 1 through 9 should contain a leading zero).
    • If the value is not a number between 1 and 12 inclusive, display the value 'Not a valid month'.
    • Name the custom format Monthfmt.
  • Use a PROC PRINT step to create a report based on Certadv.Monsal. Apply the Monthfmt custom format to the Month variable.

Test Your Code

How many instances of 'Not a valid month' does your output contain?

Exam Objective

Specify a template using the PICTURE statement within the FORMAT procedure.
Last updated: October 16, 2019
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset