SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Quiz: Formatting Variable Values

Select the best answer for each question and click Score My Quiz.

  1. Which format displays the value 5349.41 as $5,349.41?

     a.   dollar6.2
     b.   dollar7.2
     c.   dollar8.2
     d.   dollar9.2

  2. When you place a FORMAT statement in a procedure step, the formats that are associated with the variables remain in effect

     a.   only for that particular procedure.
     b.   only for that particular data set.
     c.   only for that particular processing run.
     d.   only for that particular SAS session.

  3. What is the effect of the format statement shown below?
    data work.aprbills;
       set perm.aprbills;
       RoomChg=days*roomrate;
       format roomchg 8.2;
    run;

     a.   It creates the format RoomChg, defined as 8.2.
     b.   It temporarily associates the variable RoomChg with the character format 8.2.
     c.   It temporarily associates the variable RoomChg with the numeric format 8.2.
     d.   It permanently associates the variable RoomChg with the numeric format 8.2.

  4. Consider the program shown below. If the variable RoomChg includes a value of 1250, how will that value appear in the PROC PRINT output?
    data work.aprbills;
       set perm.aprbills;
       RoomChg=days*roomrate;
       format roomchg 8.2;
    run;
    proc print data=work.aprbills;
       format roomchg dollar6.;
    run;

     a.   1250.00
     b.   1,250
     c.   $1,250
     d.   $1250.00

  5. When you permanently associate a format with a variable, the format

     a.   affects variable values as they are stored in a SAS data set.
     b.   affects variable values as they are read into the program data vector.
     c.   only affects the way that variable values are processed.
     d.   only affects the way that variable values are displayed in output.

  6. 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\formats\lib';
    proc format library
       ...;

  7. When creating a format with the VALUE statement, the new format's 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.

  8. Which of these is not true? Ranges in the VALUE statement can specify

     a.   a single value, such as 24 or 'S'.
     b.   a range of values, such as 0-1500.
     c.   a range of characters, such as 'A'-'M'.
     d.   a list of numeric and character values separated by commas, such as 90,'B',180,'D',270.

  9. Which keyword addresses missing values in a range?

     a.   LOW
     b.   MISS
     c.   MISSING
     d.   OTHER

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

     a.   format jobtitle jobfmt;
     b.   format jobtitle jobfmt.;
     c.   format jobtitle=jobfmt;
     d.   format jobtitle='jobfmt';



back||next

Terms of Use & Legal Information | Privacy Statement