SAS Chapter 14: Combining Data Vertically

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Moxleyv
M
Moxleyv
Community Contributor
Quizzes Created: 38 | Total Attempts: 21,992
| Attempts: 119 | Questions: 10
Please wait...
Question 1 / 10
0 %
0/100
Score 0/100
1. Which of the following statements is true?

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.

Submit
Please wait...
About This Quiz
SAS Chapter 14: Combining Data Vertically - Quiz

This SAS quiz focuses on combining data vertically, assessing skills in managing and manipulating datasets. It includes practical scenarios on file handling and data processing, essential for learners... see moreaiming to enhance their data management capabilities in SAS. see less

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

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.

Submit
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;

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.

Submit
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;
 

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.

Submit
5. Which program appends Work.London to Work.Flights?

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.

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

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.

Submit
7. Which program appends Work.April to Work.Y2003?

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.

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

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.

Submit
9. 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.

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.

Submit
10. Which of the following statements is false?

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.

Submit
View My Results

Quiz Review Timeline (Updated): Feb 8, 2024 +

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
Cancel
  • All
    All (10)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
Which of the following statements is true?
What happens when the SAS data set Work.NewHires is appended...
  ...
If the current date is March 30, 2003, which table correctly shows the...
Which program appends Work.London to Work.Flights?
What happens when the following program is submitted? ...
Which program appends Work.April to Work.Y2003?
You do not need to use the FORCE option with PROC APPEND...
Which of the following statements associates the...
Which of the following statements is false?
Alert!

Advertisement