SAS Chapter 14: Combining Data Vertically

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: 21,441
Questions: 10 | Attempts: 119

SettingsSettingsSettings
SAS Chapter 14: Combining Data Vertically - Quiz


Practice for the SAS advance certification exam.


Questions and Answers
  • 1. 

    Which of the following statements associates the fileref OnSale with the raw data files London.dat, Paris.dat, and Zurich.dat? The files are stored in the C:\Routes\New directory in the Windows operating environment.

    • A.

      filename onsale (c:\routes\new\london.dat, c:\routes\new\paris.dat, c:\routes\new\zurich.dat);

    • B.

      filename onsale 'c:\routes\new\london.dat' 'c:\routes\new\paris.dat' 'c:\routes\new\zurich.dat';

    • C.

      filename onsale ('c:\routes\new\london.dat' 'c:\routes\new\paris.dat' 'c:\routes\new\zurich.dat');

    • D.

      filename onsale 'c:\routes\new\london.dat c:\routes\new\paris.dat c:\routes\new\zurich.dat';

    Correct Answer
    C. filename onsale ('c:\routes\new\london.dat' 'c:\routes\new\paris.dat' 'c:\routes\new\zurich.dat');
    Explanation
    When a FILENAME statement is used to assign a fileref to multiple raw data files, the list of files must be enclosed in a single set of parentheses. Each filename specified must be enclosed in quotation marks.

    Rate this question:

  • 2. 

    Which of the following statements is true?

    • A.

      The FILEVAR= option can be used to dynamically change the currently opened input file to a new physical file.

    • B.

      The FILEVAR= variable is not written to the data set.

    • C.

      The FILEVAR= variable must contain a character string that is a physical filename.

    • D.

      All of the above

    Correct Answer
    D. All of the above
    Explanation
    The FILEVAR= option enables you to dynamically change the currently opened input file to a new input file. The FILEVAR= variable must contain a character string that is a physical filename. Like automatic variables, the FILEVAR= variable is not written to the data set.

    Rate this question:

  • 3. 

    Given the following program, which table correctly shows the corresponding values of the variables x and readfile? data work.revenue; do x = 8, 9, 10; readfile=compress("c:\data\month" !!put(x,2.)!!".dat",' '); do until (lastobs); infile temp filevar=nextfile end=lastobs; input Date : date7. Location $ Sales : dollar10.2; output; end; end; stop; run;

    Correct Answer
    B.
    Explanation
    The DO statement creates the index variable x and assigns it the values of 8, 9, and 10. The assignment statement assigns the name of a raw data file to readfile using the current value of x and the PUT function, which concatenates the values of x with the text strings c:\data\month and .dat. The COMPRESS function removes blank spaces from the values of readfile.

    Rate this question:

  • 4. 

    If the current date is March 30, 2003, which table correctly shows the corresponding values of the variables y1, y2, y3, and nextfile? data work.quarter (drop=monthnum midmon lastmon); y3=year(today()); y2=y3-1; y1=y3-2; do i = y3, y2, y1; nextfile="c:\data\Y"!!put(i,4.)!!".dat"; do until (lastobs); infile temp filevar=nextfile end=lastobs; input Flight $ Origin $ Dest $ Date : date9.; output; end; end; stop; run;  

    Correct Answer
    A.
    Explanation
    The TODAY function returns the current date from the system clock as a SAS date value. The year number is then extracted from the current date using the YEAR function. The value of the current year, 2003, is assigned to y3. The year values 2002 and 2001 are assigned to y2 and y1, respectively. The PUT function concatenates the text string c:\data\Y with the year values and the text string .dat.

    Rate this question:

  • 5. 

    Which of the following statements is false?

    • A.

      The END= variable is set to 0 when SAS processes the last data record in the input file.

    • B.

      The END= variable is set to 1 when SAS processes the last data record in the input file.

    • C.

      The END= variable is not written to the data set.

    • D.

      A and c

    Correct Answer
    A. The END= variable is set to 0 when SAS processes the last data record in the input file.
    Explanation
    The END= option enables you to name a variable whose value is controlled by SAS. The value of the variable is 0 when you are not reading the last record in an input file and 1 when you are reading the last record in an input file. You can test the value of the END= variable to determine if the DATA step should continue processing. Like automatic variables, the END= variable is not written to the SAS data set.

    Rate this question:

  • 6. 

    Which program appends Work.London to Work.Flights?

    • A.

      proc append base=work.london data=work.flights; run;

    • B.

      proc append data=work.london base=work.flights; run;

    • C.

      proc append data=work.london work.flights; run;

    • D.

      proc append data=work.flights work.london; run;

    Correct Answer
    B. proc append data=work.london base=work.flights; run;
    Explanation
    PROC APPEND uses the BASE= and DATA= arguments. BASE=SAS-data-set names the data set to which you want to add observations. DATA=SAS-data-set names the SAS data set containing observations that you want to append to the end of the SAS data set specified in the BASE= argument.

    Rate this question:

  • 7. 

    What happens when the following program is submitted? proc append base=staff.marketing data=staff.sales force; run;

    • A.

      The length of LastName is converted to 20 in Staff.Marketing.

    • B.

      LastName is dropped from Staff.Marketing.

    • C.

      Missing values are assigned to LastName observations that are read in from Staff.Sales.

    • D.

      Some of the values of LastName may be truncated in the observations that are read in from Staff.Sales.

    Correct Answer
    D. Some of the values of LastName may be truncated in the observations that are read in from Staff.Sales.
    Explanation
    If a DATA= data set contains variables that are longer than the corresponding variables in the BASE= data set, the FORCE option must be used with PROC APPEND. Using the FORCE option enables you to append the data sets. However, some of the variable values may be truncated in the observations that are read in from the DATA= data set.

    Rate this question:

  • 8. 

    Which program appends Work.April to Work.Y2003?

    • A.

      proc append base=work.y2003 data=work.april; run;

    • B.

      proc append base=work.april data=work.y2003 force; run;

    • C.

      proc append base=work.y2003 data=work.april force; run;

    • D.

      proc append base=work.april data=work.y2003; run;

    Correct Answer
    C. proc append base=work.y2003 data=work.april force; run;
    Explanation
    You must use the FORCE option with PROC APPEND when the DATA= data set contains a variable that does not have the same type as the corresponding variable in the BASE= data set.

    Rate this question:

  • 9. 

    What happens when the SAS data set Work.NewHires is appended to the SAS data set Work.Employees using PROC APPEND?

    • A.

      Missing values are assigned to Room for the observations that are read in from Work.NewHires.

    • B.

      Missing values are assigned to Room for all of the observations in Work.Employees.

    • C.

      Room is dropped from Work.Employees.

    • D.

      The values of Name are truncated in the observations that are read in from Work.NewHires.

    Correct Answer
    A. Missing values are assigned to Room for the observations that are read in from Work.NewHires.
    Explanation
    PROC APPEND reads only the data in the DATA= SAS data set, not the BASE= SAS data set. When the BASE= data set contains more variables than the DATA= data set, missing values for the additional variables are assigned to the observations that are read in from the DATA= data set.

    Rate this question:

  • 10. 

    You do not need to use the FORCE option with PROC APPEND when

    • A.

      The DATA= data set contains variables that are not in the BASE= data set.

    • B.

      The BASE= data set contains variables that are not in the DATA= data set.

    • C.

      The variables in the DATA= data set are longer than the corresponding variables in the BASE= data set

    • D.

      The variables in the DATA= data set have a different type than the corresponding variables in the BASE= data set.

    Correct Answer
    B. The BASE= data set contains variables that are not in the DATA= data set.
    Explanation
    The FORCE option does not need to be used if the BASE= data set contains variables that are not in the DATA= data set. The FORCE option must be used if

    the DATA= data set contains variables that are not in the BASE= data set

    the variables in the DATA= data set are longer than the corresponding variables in the BASE= data set

    the variables in the DATA= data set have a different type than the corresponding variables in the BASE= data set.

    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
  • Feb 08, 2024
    Quiz Edited by
    ProProfs Editorial Team
  • Mar 29, 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.