Beruflich Dokumente
Kultur Dokumente
1.
2.
The
The
The
The
data
data
data
data
set
set
set
set
TEMP
TEMP
TEMP
TEMP
is
is
is
is
SEATBELT
-------No
No
No
No
No
SPEED
----0-29
0-29
30-49
30-49
50+
STATUS
------Serious
Not
Serious
Not
Serious
COUNT
----31
1419
191
2004
216
3.
1
0
2
5
4.
AGE
--28
25
28
33
18
25
35
SALARY
-----200
100
300
300
100
200
400
BONUS
----20
10
10
30
50
10
50
5.
3
5
6
4
6.
The
The
The
The
index
index
index
index
on
on
on
on
STATE
STATE
STATE
STATE
is
is
is
is
updated as an index on ST
deleted and an index on ST is created
recreated as an index on ST
deleted
The SAS data set ONE contains fifty million observations and contains the variables PRICE, QUANTITY, FIXED, and
VARIABLE.
Which SAS program successfully creates three new variables TOTREV, TOTCOST, and PROFIT and requires the least amount
of CPU resources to be processed?
A. DATA TWO;
SET ONE;
TOTREV=SUM(PRICE*QUANTITY);
TOTCOST=SUM(FIXED,VARIABLE);
IF TOTREV > 1000;
PROFIT=SUM(TOTREV,-TOTCOST);
RUN;
7.
8.
11
3
7
8
AREA
----NORTH
SOUTH
EAST
NORTH
WEST
NORTH
NORTH
NORTH
WEST
WEST
COST
---100
200
100
300
100
200
400
400
100
300
AREA
EAST
NORTH
WEST
NORTH
SOUTH
NORTH
SOUTH
TOTAL
1
2
3
3
1
3
1
9.
B. REP
JONES
JONES
JONES
SMITH
SMITH
AREA
EAST
NORTH
WEST
NORTH
SOUTH
TOTAL
100
600
500
800
200
C. REP
JONES
JONES
JONES
SMITH
SMITH
AREA
EAST
NORTH
WEST
NORTH
SOUTH
TOTAL
100
600
500
800
200
D. REP
JONES
JONES
JONES
SMITH
SMITH
AREA
EAST
NORTH
WEST
NORTH
SOUTH
TOAL
1
2
3
3
1
Which statement(s) in the DATASETS procedure alter(s) the name of a SAS data set stored in a SAS data library?
A.
B.
C.
D.
10.
RENAME
CHANGE
MODIFY
MODIFY
statement only
statement only
and RENAME statements
and CHANGE statements
1.
1.8
2
1
Null
(B) The LENGTH statement does not determine the width of the display value (that is controlled by FORMAT) but rather
the number of bytes used for storing variable values. Because the SAS default is to assign numeric type to input
variables (and this example lacks the necessary $ preceding the number for character type), these variables are
clearly assigned a numeric type.
This program fails initially because numeric values must be assigned a length of between 2 to 8 (typically 3 to 8)
depending on the operating environment. So, variable A has been assigned an improper length.
An additional error would occur on variable X. It is assigned in the LENGTH statement, but it is not given a variable
length.
2.
(C) This SAS program is composed of a macro program called HIGHWAY which spans from the %MACRO statement to the %MEND
statement.
When the macro program is called, it executes the code within that span. The NOPRINT option in the PROC SQL statement
indicates that no report will be generated; that is, no table is printed in the output window.
The INTO clause creates macro variables equal to the number of distinct values in the STATUS column. Therefore, there
are two values (1 and 2) for the two distinct statuses (SERIOUS and NOT).
3.
(C) A table in SQL language is synonymous with data set in SAS. So, to delete an entire data set using PROC SQL,
you must invoke the DROP TABLE statement using the following syntax:
DROP TABLE table-name-1 <, table-name-n>;
Where table-name specifies the name of the table(s) to be dropped.
4.
(A) The first thing PROC SQL does is execute the FROM clause. This eliminates the observations where the variable AGE
possesses a value greater than or equal to 33. So, this leaves five observations.
The next thing it does is create a new table called TWO while only using the variable AGE from data set ONE. Within
this, it uses the keyword DISTINCT to select only unique values for the variable AGE. This eliminates the duplicates
and leaves only three observations.
5.
(D) An index is an optional file that can be created for a SAS data file in order to provide direct access to
specific observations.
SAS maintains indexes for all changes to the table, whether the changes originate from PROC SQL or some other source,
as long as the entire table is not re-created. If you alter a columns definition or update its values, then SAS will
update the indexes also. However, if a key column in a table is dropped (deleted), then the index on that column is
also dropped.
As you can see, the SET statement identifies the same data set as the DATA statement. Therefore, the data set is recreated and all indexes are deleted.
6.
(C) First, understand that SAS evaluates code line by line sequentially. Without knowing anything else besides that,
you can eliminate option (B) because it is attempting to apply a WHERE clause with an expression to a variable that
doesnt even exist in the data set. Therefore, SAS will clearly return an error and the program will fail.
The next thing to understand is a fundamental difference between WHERE statements and the subsetting IF statement.
Normally, when youre attempting to subset data, the WHERE statement is more efficient because it can evaluate data
in the buffer before it decides whether or not to pass it along to the program data vector (PDV). On the other hand,
the subsetting IF statement must wait until the data has entered the PDV before it can be evaluated based on
prescribed conditions.
The catch in this instance is that a WHERE statement can only select observations from SAS data sets, whereas the IF
statement can select records from external files, observations from SAS data sets, observations created with an INPUT
statement, or, in this case, observations based on the value of a computed or derived variable.
Because TOTREV is a created variable, the WHERE statement is unable to subset it in the same DATA step, and the
program fails.
This leaves you with only options (A) and (C) to consider. Both would accomplish the task, but option (A) does not
attempt to subset until after its already created an additional variable (TOTCOST). Therefore, its more efficient
to evaluate the subsetting IF and decide whether or not to pass on the record immediately after TOTREV has been
created instead of creating an additional variable that may just be discarded anyway.
7.
8.
9.
(B) You can use the DATASETS procedure to alter the name of an established data set using the CHANGE statement. The
syntax is as follows:
PROC DATASETS LIBRARY=libref <NOLIST>;
CHANGE old-data-set-name = new-data-set-name;
QUIT;
Note: The RENAME statement allows you to rename variables as a file management task using the DATASETS procedure.
This method does not require DATA step processing.
The MODIFY statement changes the attributes of a SAS file and, through the use of subordinate statements, the
attributes of variables in the SAS file.
10.
(C) The %LET statement allows you to create your own macro variable and assign a value to it. In this example, the
macro variable VALUE is created with a value of 9, and the macro variable ADD is created with a value of 5.
The %EVAL function evaluates integer arithmetic or logical expressions. However, if an operation results in a noninteger value, %EVAL truncates the value to an integer.
Using standard arithmetic, we know that 9 divided by 5 equals 1.8. As was previously mentioned, SAS truncates noninteger values. It does not round them. So, the 1.8 is truncated to an integer value of 1.
11.
Which one of the following SORT procedure options eliminates identical, consecutive observations?
A.
B.
C.
D.
12.
DISTINCT
NODUPKEY
NODUP
UNIQUE
13.
BUFSIZE=
BUFSIZE=
BUFSIZE=
BUFSIZE=
specifies
specifies
specifies
specifies
the
the
the
the
size
size
size
size
of
of
of
of
the
the
the
the
14.
WORK.HOUSES
work.houses
WORK.RANCH
work.ranch
AGE
--15
16
12
15
15.
WHERE
WHERE
WHERE
WHERE
UPCASE(NAME)=UPCASE(&VALUE);
UPCASE(NAME)=UPCASE(&VALUE);
UPCASE(NAME)=%UPCASE(&VALUE);
UPCASE(NAME)=%UPCASE(&VALUE);
Y
-52
45
13
56
34
12
78
16.
BY
BY
BY
BY
X;
DESCENDING X;
X GROUPED;
X NOTSORTED;
17.
A
A
A
A
is
is
is
is
bird
cat
&A
pig
18.
Result
Result
Result
Result
is
is
is
is
10 GT 5
TRUE
1
0
19.
is 10+0.5
is
is 10
is 10.5
Which one of the following is an advantage of creating and using a SAS DATA step view?
A.
B.
C.
D.
20.
Result
Result
Result
Result
It
It
It
It
11.
The variables named POINTS10, POINTS15, POINTS20, POINTS25, POINTS30, and POINTS35 are created in the PDV
The variables named POINTS1, POINTS2, POINTS3, POINTS4, POINTS5, and POINTS6 are created in the PDV
The variables named POINTS11, POINTS12, POINTS13, POINTS21, POINTS22, and POINTS23 are created in the PDV
No variables are created in the PDV
(C) The NODUP option causes PROC SORT to compare all variable values for an observation to the previous one written
to the output data set. Therefore, when using the NODUP option, the data set must be sorted by enough variables to
ensure that the observations are in the correct order to remove all duplicates.
12.
(D)
13.
(A) SYSLAST is an automatic SAS variable that names the most recently created SAS data set, in the form LIBREF.NAME.
This value is always stored in all capital letters. If no data set has been created, the value is _NULL_.
In this example, the %MACRO statement assigns two keyword parameters (dsn and sub) with the two values (houses and
RANCH, respectively). These macro variables are the defaults for the macro program houses.
The first time the macro houses is called, it executes with the macro variable dsn having the value houses, and the
macro variable sub has its default value replaced with SPLIT. Hence, the most recently executed data set is
WORK.HOUSES.
The macro houses is called a second time. This time the dsn macro variable has a substituted value of ranch, and the
macro variable sub has a value of RANCH. Hence, the most recently executed data set is WORK.RANCH.
The macro houses is called a third time. In this instance, the macro variable dsn has a value of houses, and the
macro variable sub has a value of TWOSTORY. Hence, the most recently executed data set, and the answer, is
WORK.HOUSES.
Note: You may view automatic SAS variables values by evoking the SYMBOLGEN system option. For example: OPTIONS
SYMBOLGEN;
14.
(C) The UPCASE function copies a character argument, converts all lowercase letters to uppercase letters, and returns
the altered value as a result.
When youre attempting to apply the UPCASE function to a macro variable, you must precede the enclosed macro variable
in parentheses with the %UPCASE function.
15.
(D) Option (A) returns an error because in the data set TEMP, it was not already sorted by the variable X in
ascending order. Option (B) returns an error as well because the data set TEMP was not previously sorted in ascending
order. Option (C) returns an error because GROUPED is not an option. SAS assumes its a variable that it cant find.
The NOTSORTED option allows you to group observations in a data set by the formatted values of the BY variables
without requiring that the data be sorted or indexed.
16.
(B) In this example, you have the creation of a global macro variable A with a value of cat created at the beginning.
Theres also a macro program called ANIMAL with a keyword parameter attached.
When the macro ANIMAL is called, it has a new keyword parameter assigned: variable A with the value pig. However,
when this parameter is applied to the macro, the value of variable A is immediately overwritten with bird.
Therefore, you have a local macro variable A which resolves to bird within the macro program, and a global macro
variable A that resolves to cat outside the macro program.
17.
(C) The macro program CHECK creates a local macro variable NUM with a value of 4. The macro call %CHECK(NUM=10)
resolves the variable NUM with a value of 10 when initialized.
The %EVAL function evaluates integer arithmetic or logical expressions. In this instance, as a result of the %Let
statement in the macro program CHECK, it is being asked to perform a logical expression to check if the value of &NUM
(which is 10) is greater than 5. If the result of the logical expression is true, SAS returns a value of 1. If it is
false, SAS returns a value of 0. Quite clearly, 10 is greater than 5, so SAS returns a value of 1.
Note: If the macro call %CHECK(NUM=10) had omitted the additional element (i.e. simply %CHECK), then SAS would have
evaluated 4 against 5 and returned a value of 0.
18.
19.
(B)
20.
21.
22.
To
To
To
To
reduce
reduce
reduce
reduce
memory usage
the amount of data read
network traffic
the number of I/O operations
23.
Null
0
6
3
24.
Which one of the following displays the definition of a stored SQL procedure view in the SAS log?
A.
B.
C.
D.
25.
Which SAS procedure changes the name of a permanent format for a variable stored in a SAS data set?
A.
B.
C.
D.
26.
ECHOVIEW option
EXPANDVIEW option
DESCRIBE VIEW statement
VALIDATE VIEW statement
FORMAT
DATASETS
REGISTRY
MODIFY
The SAS data set ONE contains the variables X, Y, Z, and W, and it is sorted in ascending order by the X variable.
The following SAS program is submitted:
PROC TRANSPOSE DATA=ONE
OUT=TRANS
NAME=NEW;
BY X;
VAR Y;
RUN;
What are the names of all of the columns created by the TRANSPOSE procedure?
A.
B.
C.
D.
27.
X,
X,
Y,
X,
Y, and _COL1_
and Y only
and COL1 only
and COL1 only
Which one of the following SAS integrity constraint types ensures that a specific set or range of values are the only
values in a variable?
A.
B.
C.
D.
28.
NEW,
NEW,
NEW,
NEW,
CHECK
DISTINCT
UNIQUE
FORMAT
It
It
It
It
names
names
names
names
the
the
the
the
variable
variable
variable
variable
NEXTFILE,
NEXTFILE,
NEXTFILE,
NEXTFILE,
whose
whose
whose
whose
30.
A
A
A
A
macro
macro
macro
macro
variable
variable
variable
variable
DATE
DATE
DATE
DATE
with
with
with
with
the
the
the
the
value
value
value
value
12SEP2008
12SEP2008
12SEP2008
31DEC2006
AGE
--10
20
20
10
10
30
10
20
30
10
is
is
is
is
retrieved
retrieved
retrieved
retrieved
from
from
from
from
the
the
the
the
21.
22.
(C) The %INDEX function enables you to determine the position of the first character of a string within another
string. The syntax for the %INDEX function is as follows:
%INDEX(source,string)
Both source and string are character strings or text expressions that can include constant text, macro variable
references, macro functions, or macro calls.
In this example, the macro variable JOBS acts as the source and resolves to BLACKSMITH WORDSMITH SWORDSMITH. The
macro variable VAR acts as the string and resolves to SMITH once the macro call %TEST(SMITH) is initialized.
So, what SAS does is begin scanning from left to right within the source variable (BLACKSMITH WORDSMITH SWORDSMITH)
until it finds the identified string variable (SMITH). At that point it marks its location where the string variable
first appears (6).
Note: You can print this identifying location to the SAS log if you include the following statement within the macro
program:
%PUT &VAR is at position &TYPE.;
Also, if you change the element in the macro call from SMITH to SWORD, your new value will be 22.
23.
(C) When you use the DATA _NULL_ statement, SAS processes the DATA step without writing observations to a data set.
Using the DATA _NULL_ statement can considerably increase program efficiency.
The SYMPUT routine assigns DATA step information to a macro variable. The syntax is as follows:
CALL SYMPUT(argument-1,argument-2);
argument-1 specifies a character expression that identifies the macro variable that is assigned a value. If the macro
variable does not exist, the routine creates it.
argument-2 specifies a character constant, variable, or expression that contains the value that is assigned.
In this instance, the macro variable PROC is created, and it is assigned a value of MEANS.
So, when the macro ONE is called via %ONE(), the macro variable PROC resolves to MEANS and executes the MEANS
procedure.
The macro ONE is created without any additional parameters (neither KEYWORD nor POSITIONAL parameters). When the
macro ONE is called via %ONE(), the parentheses indicate that the default parameters for the macro are to be used.
However, because none were used, it is moot. This method is synonymous with simply using %ONE;
Typically, macro variables that are created within a macro are stored in the local symbol table and exist only during
the execution of that macro that defines the variable. However, in this instance the macro variable is being used to
execute an active report (the MEANS procedure), and is therefore passed to the global symbol table.
Note: You can verify this after running the PROC SQL code by viewing the DICTIONARY.MACROS table.
PROC SQL;
SELECT *
FROM DICTIONARY.MACROS;
QUIT;
24.
(C) The DESCRIBE VIEW statement displays a definition of a view in the SAS log.
25.
(B) The DATASETS procedure, when used in conjunction with the FORMAT statement, permanently assigns, changes, and
removes variable formats in the SAS data set specified in the MODIFY statement. The syntax is as follows:
FORMAT variable-1 <format-1>
<variable-n <format-n>>;
Where variable-1 <variable-n> specifies one or more variables whose format you want to assign, change or remove. If
you want to disassociate a format with a variable, list the variable last in the list with no format following.
(D) The PROC TRANSPOSE statement creates an output data set by restructuring values in a SAS data set, transposing
selected variables into observations. The syntax is as follows:
PROC TRANSPOSE <DATA=input-data-set>
<OUT=output-data-set>
<NAME=variable-name>
<PREFIX=variable-name>;
BY <DESCENDING> variable-1 ... variable-n
<NOTSORTED>;
VAR variable(s);
RUN;
If an output-data-set does not exist, PROC TRANSPOSE creates it by using the DATA n naming convention. Also, if you
omit the VAR statement, the TRANSPOSE procedure transposes all of the numeric variables in the input data set that
are not listed in another statement. And finally, you must list all character variables in a VAR statement if you
want to transpose them.
So, in this example, we are transposing the data set ONE. The NAME= option specifies the name of the variable in the
output data set that contains the name of the variable that is being transposed to create the current observation (if
it were omitted, the default name would be _NAME_). The VAR statement names one or more variables to transpose.
With the NAME= option and VAR statement combined, you get a column named NEW with all the values in that column being
Y.
Because the output data set is being sorted with a BY statement, all the variables included with that BY statement
will also be in the output data set. Therefore, X is also a column name.
Finally, the remaining variables listed are those of the listed variables. Here, the only transposed variable is Y
and because the PREFIX= option was not used, the default column name is COL1.
27.
(A) The integrity constraint CHECK ensures that a specific set or range of values are the only values in a column. It
can also check the validity of a value in one column based on a value in another column within a row.
28.
(B) The FILEVAR= option enables you to dynamically change the currently opened input file to a new input file.
INFILE file-specification FILEVAR=variable;
Where FILEVAR=variable names a variable whose change in value causes the INFILE statement to close the current input
file and open a new input file, and variable contains a character string that is a physical filename.
When you use an INFILE statement with the FILEVAR= option, the file specification is a placeholder, not an actual
filename or a fileref that had been assigned previously to a file. SAS uses this placeholder for reporting processing
information to the SAS log. The file specification must conform to the same rules as a fileref.
29.
(C) If you define a local macro variable and a global macro variable with the same name, the macro facility uses the
value of the local variable during the execution of the macro that contains that local variable. When the macro that
contains the local variable is not executing, the macro facility uses the value of the global variable.
In this example, you can clearly see that the %LET statement creates a global macro variable called DATE with a value
of 31DEC2006.
The CALL SYMPUT function in macro TWO also creates global a macro variable called DATE but with a value of 12SEP2008.
However, this only occurs if the macro program TWO is called.
As you can see, the macro program ONE is called with a macro variable parameter &DATE that resolves to 31DEC2006.
So, when the macro program ONE executes, the initial value of the global macro variable DATE is 31DEC2006. However,
the first line of code within the ONE macro program calls the macro program TWO which then executes within the ONE
macro program and the CALL SYMPUT function creates a global macro variable called DATE with a value of 12SEP2008
which overwrites the previous DATE macro variable value. This new value is then displayed in the PUT statement.
Note: If the macro program TWO hadnt been called (that is, removing %TWO; from macro program ONE), the %PUT
statement would have displayed: THE VALUE IS 31DEC2006.
Additionally, if the %PUT statement had been placed before the call of macro program TWO (%TWO;), then the %PUT
statement would have printed 31DEC2006 before the macro variable DATE had its value overwritten.
(D) The first thing to notice is the SELECT clause. It extracts the variable LEVEL and creates the variable MAX.
Hence, you can immediately eliminate options (A) and (B).
A HAVING clause further refines a PROC SQL query by working with the GROUP BY clause to restrict the groups that are
displayed to the output, based on one or more specific conditions.
In
of
2,
in
31.
When reading a SAS data file, what does the NOBS= option on the SET statement represent?
A.
B.
C.
D.
32.
this example, the HAVING clause specifies only groups which have a maximum AGE value greater than the average AGE
the entire table are to be displayed. The average AGE for the entire table is 17. The maximum values for groups 1,
and 3 are 10, 30, and 30 (respectively). Therefore, group 1 does not qualify and only groups 2 and 3 are displayed
the output.
A
A
A
A
variable
variable
variable
variable
that
that
that
that
represents
represents
represents
represents
33.
Which one of the following is the purpose of the IDXNAME= data set option?
A.
B.
C.
D.
34.
9
2
Null
0
It
It
It
It
instructs
instructs
instructs
instructs
SAS
SAS
SAS
SAS
to
to
to
to
36.
Which one of the following SAS programs uses the most amount of memory resources for output buffers?
A. DATA NEW (BUFSIZE=2000 BUFNO=3);
SET TEMP;
RUN;
B. DATA NEW (BUFSIZE=4000 BUFNO=1);
SET TEMP;
RUN;
C. DATA NEW (BUFSIZE=1000 BUFNO=5);
SET TEMP;
RUN;
D. DATA NEW (BUFSIZE=1000 BUFNO=2);
SET TEMP;
RUN;
37.
The SAS data sets CLASS1 and CLASS2 are given below:
CLASS1
NAME
COURSE
------ -----Lauren MATH1
Patel MATH1
Chang MATH1
Chang MATH3
CLASS2
NAME
COURSE
------ -----Smith MATH2
Farmer MATH2
Patel MATH2
Hiller MATH2
38.
Which one of the following statements is true regarding a SAS DATA step view?
A.
B.
C.
D.
39.
It
It
It
It
The SAS data set WORK.TEMPDATA contains the variables FMTNAME, START, and LABEL and it consists of 10 observations.
The following SAS program is submitted:
PROC FORMAT CNTLIN=WORK.TEMPDATA;
RUN;
What is the result of submitting the FORMAT procedure?
A.
B.
C.
D.
40.
An ERROR message is written to the SAS log because the program is incomplete
No formats are created in this step
All formats created will be stored in the WORK.TEMPDATA SAS data set
It uses the WORK.TEMPDATA SAS data set as input to create the format
The SAS data sets ONE and TWO are given below:
ONE
NUM COUNTRY
--- ------1
CANADA
2
FRANCE
3
GERMANY
4
BELGIUM
5
JAPAN
TWO
NUM CITY
--- ------3
BERLIN
5
TOKYO
(C) The NOBS= option creates and names a temporary variable whose value is usually the total number of observations
in the input data set or data sets. If more than one data set is listed in the SET statement, NOBS= the total number
of observations in the data sets that are listed. The number of observations includes those observations that are
marked for deletion but are not yet deleted.
32.
(D) A numerator is allowed to take on the value of zero in a fraction. Any legal fraction (denominator not equal to
zero) with a numerator equal to zero has an overall value of zero.
Note: Null is synonymous with missing. If the zero had instead been in the denominator, the answer would have instead
been Null and an error would have been written to the log.
ERROR: Division by zero in %EVAL is invalid.
33.
(B) The IDXNAME= data set option directs SAS to use a specific index to match the conditions of a WHERE expression.
Note: DO not confuse with the IDXWHERE= option which specifies whether or not SAS should use an index to process the
WHERE expression, no matter which access method SAS estimates is faster.
34.
(C) The DESCRIBE TABLE statement lists all indexes for one or more tables that you specify, along with other
information about the table(s).
35.
(B) The macro variable LIB is assigned the value sasuser. The %UPCASE function capitalizes all letters of the value,
which is essential because thats how it is stored within SAS, and encloses it in quotation marks. So, the library
name has been specified.
The variable of note is NVAR, which specifies the number of columns (or variables) for each table in the SASUSER
library.
36.
(A) The BUFNO= option specifies the number of buffers to be used. The BUFSIZE= option controls the page size of an
output data set. To calculate which option requires the most amount of memory resources, simply multiply the value
for BUFNO by the value for BUFSIZE.
37.
(A) The set operator EXCEPT does both of the following: (1) It selects unique rows from the first table (the table
specified in the first query) that are not found in the second table (the table specified in the second query). (2)
It overlays columns.
The keyword ALL follows the operator and tells SAS to make only one pass through the data and does not remove
duplicate rows.
Note: If the data set CLASS2 contained a NAME variable with the value CHANG, the output table would have CHANG and
LAUREN because one CHANG value in CLASS2 would cancel one of the two CHANG values in CLASS1.
38.
(A) A DATA step view contains a partially compiled DATA step program that can read data from a variety of sources. A
DATA step view can be created only in a DATA step. A DATA step view cannot contain global statements, host-specific
data set options, or most host-specific FILE and INFILE statements. Also, a DATA step view cannot be indexed or
compressed.
39.
(D) You can create a format from a SAS data set that contains value information (called a control data set). To do
this, you use the CNTLIN= option to read the data and create the format. The syntax is as follows:
PROC FORMAT LIBRARY=libref.catalog
CNTLIN=SAS-data-set;
Where libref.catalog is the name of the catalog in which you want to store the format and SAS-data-set is the name of
the SAS data set that you want to use to create the format.
40.
(A) The first thing you should notice is that the SELECT clause will only display one variable (or column), COUNTRY.
The second is that the program involves a subquery. A subquery, or inner query, is a query-expression that is nested
as part of another query-expression. In this instance, the subquery is used in conjunction with the WHERE NOT EXISTS
expression.
This expression calls for all observations to be output where the value of the variables NUM in data sets ONE and TWO
are not equal to each other. So, CANADA, FRANCE, and BELGIUM.
41.
42.
ORDER BY 1, 3 DESC
ORDERBY PRODUCT, REVENUE DESC
ORDER BY 1, 3
ORDER BY PRODUCT, DESC REVENUE
COST
---200
400
100
600
100
200
400
800
100
300
44.
Positional
Command
Keyword
Default
45.
The KEEP
The KEEP
created
The KEEP
The KEEP
statement selects the variables read from the input data set(s)
statement applies only to the first data set created within the same DATA step if more than one data set
statement is available in both the DATA and PROC steps
statement applies to all data sets created within the same DATA step
Which one of the following is the purpose of the REUSE=YES option in a compressed SAS data set?
A.
B.
C.
D.
49.
48.
SOURCE
MACRO
SYMBOLGEN
SOURCE2
47.
Which one of the following options displays the value of a macro variable in the SAS log?
A.
B.
C.
D.
46.
The
The
The
The
It
It
It
It
SUM
--765
123
564
50.
Macro
Macro
Macro
Macro
variable
variable
variable
variable
GROUP
C has
GROUP
C has
41.
(A) The output table will contain three columns: PRODUCT, TYPE, and the created REVENUE column. When referencing
these columns, they can also be identified by their position in the SELECT clause. So, PRODUCT=1, TYPE=2, and
REVENUE=3.
To sort the output data by PRODUCT and decreasing REVENUE, you can order by 1 to indicate PRODUCT and 3 to indicate
REVENUE. To list REVENUE by decreasing values, place the keyword DESC after the column name.
Note: The DESC keyword in SQL performs the same task as the DESCENDING keyword in the BY statement of a SORT
procedure. However, in the SORT procedure, the DESCENDING keyword comes before the variable you intend to reorder.
Additionally, option (B) would have also been correct had the ORDER BY clause been written properly.
42.
(C) Note that the two columns in the output table will be REP and the created column AVERAGE.
The GROUP BY clause places REP into the number of unique groups associated with the REP column (SMITH and JONES).
A HAVING clause further refines a PROC SQL query by working with the GROUP BY clause to restrict the groups that are
displayed to the output, based on one or more specific conditions.
In this example, the HAVING clause compares
320) against a subquery of the average COST
will then only output the groups which have
JONES group does not meet this requirement.
43.
the average value of the COST column of the entire data set ONE (which is
of each group (SMITH and JONES) which are 500 and 200, respectively. It
an average cost greater than the average cost of the entire table. The
Therefore, SMITH is the only group that is output.
44.
(A) This is a rather tricky question. The syntax for the %SCAN function is as follows:
%SCAN (argument, n<,delimiters>)
Where argument consists of constant text, macro variable references, macro functions, or macro calls, and n is an
integer or a text expression that yields an integer, which specifies the position of the word to return. If n is
greater than the number of words in argument, the function returns a null string. Lastly, the delimiters specify an
optional list of one or more characters that separate words or test expressions that yield one or more characters.
As you can see, the %LET statement creates a macro variable VAR with the entire value CHICAGO, 1.
This macro variable is called upon in the data step. Once its inserted into the %SCAN function, the %SCAN function
reads too many arguments because it is read as %SCAN(CHICAGO, 1,2,%STR()).
45.
(C) When you submit a macro variable reference, the macro processor resolves the reference and passes the value
directly back to the input stack. You can use the SYMBOLGEN system option to monitor the value that is substituted
for a macro variable reference.
46.
(C) DICTIONARY tables are special, read-only PROC SQL tables or views. They retrieve information about all the SAS
libraries, SAS data sets, SAS system options, and external files that are associated with the current SAS session.
DICTIONARY.MACROS contains information about currently defined macro variables (both automatic and user-created).
47.
(D) The KEEP statement causes a DATA step to write only the variables listed in the KEEP statement to one or more
data sets.
The KEEP statement applies to all data sets that are created within the same DATA step.
The KEEP statement is only available in the DATA step.
48.
(A) In a compressed data set, SAS appends new observations to the end of the data set by default. If you delete an
observation within the data set, empty disk space remains in its place. However, it is possible to track and reuse
free space within the data set when you delete or update observations.
The SAS REUSE= system option and the REUSE= data set option specify whether or not SAS reuses space when observations
are added to a compressed data set. If you set the REUSE= data set option to YES in a DATA statement, SAS tracks and
reuses space in the compressed data set that is created in that DATA step. If you set the REUSE= system option to
YES, SAS tracks and reuses free space in all compressed data sets that are created for the remainder of the current
SAS session.
49.
(D) The CALL statement invokes a CALL routine. The syntax is as follows:
CALL routine(parameter-1<, ...parameter-n>);
The routine specifies the name of the SAS CALL routine that you want to invoke. The parameter is a piece of
information to be passed to or returned from the routine.
In this instance, were using the SYMPUT routine. The SYMPUT routine assigns DATA step information to a macro
variable. The syntax is as follows:
50.
(B) The FILENAME statement can be used to associate a fileref with a single raw data file. However, as it is in this
instance, it can also be used to concatenate raw data files by assigning a single fileref to the raw data files that
you want to combine. The syntax is as follows:
FILENAME fileref (external-file1 external-file2 ... external-filen);
Where fileref is any SAS name that is eight characters or fewer, and external-file is the physical name of an
external file. The physical name is the name that is recognized by the operating environment. (i.e.
C:/folders/myfolders/)
When the fileref is specified in an INFILE statement, each raw data file that has been referenced is sequentially
read into the data set using an INPUT statement.
Note: If you are not familiar with the content and structure of your raw data files, you can use PROC FSLIST to view
them.
51.
The SAS data sets ONE and TWO are given below:
ONE
COMMON
-----A
A
A
B
C
C
X
-10
13
14
9
8
14
TWO
COMMON Y
------ -A
1
A
3
B
4
B
2
C
5
COMMON
A
A
A
B
B
C
C
X
10
13
14
9
9
8
14
Y
1
3
3
4
2
5
5
B. OBS
1
2
3
4
COMMON X Y
A
10 1
A
13 3
B
9 4
C
8 5
52.
C. OBS
1
2
3
4
5
6
7
8
9
10
COMMON
A
A
A
A
A
A
B
B
C
C
X
10
13
14
10
13
14
9
9
8
14
Y
1
1
1
3
3
3
4
2
5
5
D. OBS
1
2
3
4
5
COMMON
A
A
B
B
C
X
10
13
14
9
8
Y
1
3
4
2
5
53.
Which SET statement option names a variable that contains the number of the observation to read during the current
iteration of the DATA step?
A.
B.
C.
D.
54.
The
The
The
The
NOBS=POINTOBS
POINT=POINTOBS
OBS=POINTOBS
KEY=POINTOBS
55.
Which SQL procedure deletes rows from the data set CLASS?
56.
57.
TEST=ONE;
ONE=TWO;
TWO=THREE;
THREE=LAST;
What displays is &&&&&TEST;
What
What
What
What
displays
displays
displays
displays
is
is
is
is
LAST
ONE
THREE
TWO
SALARY
-----200
205
310
523
BONUS
----20
20.5
31
52.3
59.
SELECT
SELECT
SELECT
SELECT
SALARY,
SALARY,
SALARY,
SALARY,
SALARY*.10
SALARY*.10
SALARY*.10
SALARY*.10
COLUMN=BONUS
LABEL=BONUS
NAME=BONUS
VAR=BONUS
60.
VAR
VAR
VAR
VAR
HEIGHT
%COLS1
%COLS1
%COLS2
%COLS1;
HEIGHT;
%COLS2 HEIGHT;
%COLS1;
51.
30
20
40
10
(A) A MERGE statement joins observations from two or more SAS data sets into a single observation.
52.
(B) To concatenate data sets is basically to stack one data set on top of the other.
The APPEND procedure adds the observations from one SAS data set to the end of another SAS data set. PROC APPEND does
not process the observations in the first data set. It adds the observations in the second data set directly to the
end of the original data set. The syntax is as follows:
PROC APPEND BASE=base-SAS-data-set <DATA=SAS-data-set-to-append> <FORCE>;
Where base-SAS-data-set names the SAS data set to which you want to append the observations. If this data set does
not exist, then SAS creates it. At the completion of PROC APPEND, the value of base-SAS-data-set becomes the current
(most recently created) SAS data set.
SAS-data-set-to-append names the SAS data set that contains the observations to add to the end of the base data set.
If you omit this option, then PROC APPEND adds the observations in the current SAS data set to the end of the base
data set.
FORCE forces PROC APPEND to concatenate the files in some situations in which the procedure would normally fail.
Note: This differs from using a MERGE statement. A MERGE statement will join your data horizontally.
53.
(B) The POINT= option in the SET statement names a variable. You must use program statements to assign a value to
this variable during execution of the DATA step, before execution of the SET statement. Also, the value of the POINT=
variable should be a number that corresponds to an observation number in the input data set, and it should be
different each time the SET statement executes.
54.
(D) To mitigate the time required to type long table names, you may assign abbreviated table aliases in the FROM
clause. Typically, its considered good programming practice to use the AS keyword to assign youre alias, but its
not required.
The reason why option (D) is the correct choice is because the SELECT statement attempts to references variables
using a table alias where one was not assigned.
55.
(D) To delete some or all of the rows in a table, use the DELETE statement.
56.
(B) The MODIFY statement changes the attributes of a SAS file and, through the use of subordinate statements, the
attributes of variables in the SAS file.
The DATASETS procedure is applying a label to the NUM variable as well as changing its format without affecting any
other aspect of the TESTDATA.ONE data set.
The equivalent method using the SQL procedure involves the use of the ALTER TABLE clause.
57.
58.
(B) The SAS data set option LABEL= specifies the label to be displayed for the column.
Note: This method does not create a column name; it merely labels the heading. Without assigning a column name, SAS
assigns the default _TEMA001. The code could have been written SELECT SALARY, SALARY*.10 AS PORTION LABEL=BONUS and
it would have created the column PORTION which possessed and displayed the label BONUS.
59.
60.
(A) The ARRAY statement in this instance is an example of a multidimensional array. Its syntax is as follows:
ARRAY array-name {rows,cols,} <$> <length>
<array-elements> <(initial values)>;
As you can see, the array is divided into three rows and two columns. The initial values are filled into that
temporary array sequentially (Row1-Col1, Row1-Col2, Row2-Col1, etc.).
The assignment statement creates the variable SCORE and it extracts a value from the temporary array. It goes to the
second row, first column and extracts the value 30.
61.
The SAS data set ONE consists of five million observations and has 25 variables.
Which one of the following SAS programs successfully creates three new variables, TOTREV, TOTCOST, and PROFIT and
requires the least CPU time to be processed?
A. DATA TWO;
SET ONE;
WHERE TOTREV > 1000;
TOTREV=SUM(PRICE*QUANTITY);
TOTCOST=SUM(FIXED,VARIABLE);
PROFIT=SUM(TOTREV,TOTCOST);
RUN;
B. DATA TWO;
SET ONE;
TOTREV=SUM(PRICE*QUANTITY);
TOTCOST=SUM(FIXED,VARIABLE);
PROFIT=SUM(TOTREV,TOCOST);
IF TOTREV > 1000;
RUN;
C. DATA TWO;
SET ONE;
TOTREV=SUM(PRICE*QUANTITY);
WHERE TOTREV > 1000;
TOTCOST=SUM(FIXED,VARIABLE);
PROFIT=SUM(TOTREV,TOTCOST);
RUN;
D. DATA TWO;
SET ONE;
TOTREV=SUM(PRICE*QUANTITY);
IF TOTREV > 1000;
TOTCOST=SUM(FIXED,VARIABLE);
PROFIT=SUM(TOTREV,TOTCOST);
RUN;
62.
63.
requests
requests
requests
requests
that
that
that
that
a
a
a
a
SAS
SAS
SAS
SAS
data
data
data
data
set
set
set
set
be
be
be
be
opened
opened
opened
opened
and
and
and
and
loaded
loaded
loaded
loaded
into
into
into
into
SAS
SAS
SAS
SAS
memory
memory
memory
memory
Which one of the following statements about compressed SAS data sets is always true?
A.
B.
C.
D.
64.
It
It
It
It
New observations are added to the end of the SAS data set
Each observation is treated as a single string of bytes
Each observation occupies the same number of bytes
An updated observation is stored in its original location
COST
---200
400
100
600
100
65.
66.
Which one of the following options is available for SAS macro debugging?
A.
B.
C.
D.
67.
MLOGIC
MDEBUG
MSGLEVEL
MAUTOSOURCE
68.
&FIRST
YOURNAME
&YOURNAME
FIRST
Which one of the following options controls the page size of a SAS data set?
A. BUFSIZE=
B. BUFNO=
69.
Beginning execution
%DO loop beginning; index
%DO loop index variable i
%DO loop index variable i
%DO loop index variable i
Ending execution
Which SAS system option displays the notes in the SAS log?
A.
B.
C.
D.
70.
Assume today is Tuesday, July 23, 2002. Which of the following statements submitted at the beginning of a SAS session
assigns the value Tuesday, July 23, 2002 to the macro variable START?
A.
B.
C.
D.
61.
MACRO
SYMBOLGEN
MLOGIC
MPRINT
%LET
%LET
%LET
%LET
START=%SYSFUNC(%TODAY(),WEEKDATE.);
START=TODAY(), FORMAT=WEEKDATE.;
START=TODAY(),WEEKDATE.;
START=%SYSFUNC(TODAY(), WEEKDATE.);
(D) First, understand that SAS evaluates code line by line sequentially. Without knowing anything else besides that,
you can eliminate option (A) because it is attempting to apply a WHERE clause with an expression to a variable that
doesnt even exist in the data set. Therefore, SAS will clearly return an error and the program will fail.
The next thing to understand is a fundamental difference between WHERE statements and the subsetting IF statement.
Normally, when youre attempting to subset data, the WHERE statement is more efficient because it can evaluate data
in the buffer before it decides whether or not to pass it along to the program data vector (PDV). On the other hand,
the subsetting IF statement must wait until the data has entered the PDV before it can be evaluated based on
prescribed conditions.
The catch in this instance is that a WHERE statement can only select observations from SAS data sets, whereas the IF
statement can select records from external files, observations from SAS data sets, observations created with an INPUT
statement, or, in this case, observations based on the value of a computed or derived variable.
Because TOTREV is a created variable, the WHERE statement is unable to subset it in the same DATA step, and the
program fails.
This leaves you with only options (B) and (D) to consider. Both would accomplish the task, but option (B) does not
attempt to subset until after its already created the other two variables (TOTCOST and PROFIT). Therefore, its more
efficient to evaluate the subsetting IF and decide whether or not to pass on the record immediately after TOTREV has
been created instead of creating all three variables and then discarding it.
62.
(D) The SASFILE statement holds an entire SAS data file in memory so that the data is available to multiple program
steps. Keeping the data file open reduces open/close operations, including the allocation and freeing of memory for
buffers.
(B) Compressed data files treat an observation as a single string of bytes by ignoring variable types and boundaries.
Note: Options (A), (C), and (D) refer to uncompressed data file structures.
64.
(D) In order to further subset observations within a GROUP BY clause, you must use a HAVING clause. Therefore, you
can instantly eliminate options (A) and (C).
Both HAVING clauses in (B) and (D) compare the average COST of each group to the average COST of the entire table.
However, only option (D) returns the observation that results in the desired output because the average COST for
JONES was less than the average COST of the table.Jones was
65.
(A)
66.
(A) The system option MLOGIC prints messages that indicate macro actions that were taken during macro execution. The
general form is as follows:
OPTIONS MLOGIC | NOMLOGIC;
Where NOMLOGIC is the default setting, and specifies that messages about macros are not printed to the SAS log during
macro execution. MLOGIC specifies that messages about macro actions are printed to the log during macro execution.
Note: Option (B), MDEBUG, isnt even a SAS option. Option (C) MSGLEVEL is a system option that concerns index
creation. Option (D), MAUTOSOURCE, is a system option that causes the macro processor to search the autocall
libraries for a member with the requested name when a macro name is not found in the WORK library.
67.
(B) This program involves whats known as the Forward Re-Scan Rule.
Whenever the macro processor encounters multiple ampersands or percentage signs preceding a token, the macro
processor resolves two ampersands (&&) to one ampersand (&), and re-scans the reference.
To re-scan a reference, the macro processor scans and resolves tokens from left to right from the point where
multiple ampersands or percent signs are coded, until no more triggers can be resolved.
In order to better grasp this, lets evaluate our given problem in steps.
%PUT &&&LAST;
Here, we have three ampersands preceding the macro variable LAST. As has been said, two ampersands resolve to one.
Once youve resolved two ampersands to one, imagine you drop that single ampersand to a level below your evaluation
level for each pair.
&&&LAST; So, one set of ampersands can be cancelled out and dropped down a level, but we are still left with &LAST
which can be resolved to FIRST.
&&&LAST; FIRST
&FIRST; Here, there are no more multiple ampersands to resolve, so, you can simply resolve the macro variable itself.
&FIRST; YOURNAME
Therefore, the result of the %PUT statement is YOURNAME.
68.
(A) The page size is the amount of data that can be transferred for a single I/O operation to one buffer. The page
size is a permanent attribute of the data set and is used when the data set is processed.
A larger page size can speed up execution time by reducing the number of times SAS has to read from or write to the
storage medium. However, the improvement in execution time comes at the cost of increased memory consumption.
Note: Be sure not to confuse the DATA set option BUFSIZE= with the system option PAGESIZE=. The system option
PAGESIZE specifies the number of lines that compose a page of SAS output.
69.
70.
(D) You may immediately eliminate options (B) and (C). Without the %SYSFUNC function, each value of those macro
variables are considered to be character strings.
The %SYSFUNC function makes it possible to execute most SAS functions from within a macro.
71.
72.
%LET
%LET
%LET
%LET
NAME=Patel%s Restaurant;
NAME=%STR(Patels Restaurant);
NAME=Patel%STR()s Restaurant;
NAME=%STR(Patel%s Restaurant);
73.
WHERE
WHERE
WHERE
WHERE
Salary
Salary
Salary
Salary
IS
NE
IS
NE
NOT
MISSING
NOT MISSING
NULL
74.
program
program
program
program
retrieves
creates a
retrieves
creates a
code that creates the view and places it in the output window
called SASUSER.RANCH and places the program code in the current editor window
code that creates the view and places it in the SAS log
called SASUSER.RANCH and places it in the SAS log
Which of the following is true about the COMPRESS=YES data set option?
A.
B.
C.
D.
75.
The
The
The
The
It
It
It
It
is most effective with numeric data that represents large numeric values
is most effective with character data that contains patterns, rather than simple repetitions
is most effective with character data that contains repeated characters
uses the Ross Data Compression method to compress numeric data
TWO
ID SALARY
--- -----213 150000
355 45000
523 75000
76.
Which one of the following SAS programs displays the descriptor portion of each data set stored in the SASUSER
library?
77.
78.
It
It
It
It
tracks
allows
allows
allows
79.
.5 + 5
5.5
5
Null
YEAR
---2001
2001
2002
ONE
QTR
--3
4
1
BUDGET
-----500
400
700
YEAR
---2001
2002
TWO
QTR
--4
1
SALES
----300
600
QTR
3
4
1
3
4
1
BUDGET
500
400
700
500
400
700
SALES
300
300
300
600
600
600
QTR
3
4
1
BUDGET
500
400
700
SALES
300
300
600
C. YEAR
2001
2001
2002
QTR
3
4
1
BUDGET
500
400
700
SALES
.
300
600
80.
The following are values of the variable STYLE from the SAS data set SASUSER.HOUSES:
STYLE
-------RANCH
SPLIT
SPLIT
CONDO
TWOSTORY
RANCH
CONDO
SPLIT
SPLIT
The following SAS program is submitted:
PROC SQL NOPRINT;
SELECT DISTINCT STYLE
INTO :STYLES SEPARATED BY
FROM SASUSER.HOUSES
ORDER BY STYLE;
QUIT;
Which one of the following is the value of the resulting macro variable?
A.
B.
C.
D.
71.
RANCH
CONDO
RANCH
CONDO
SPLIT
RANCH
SPLIT
RANCH
CONDO
RANCH
CONDO
SPLIT
(D) The %STR function is used to mask (or quote) tokens during compilation so that the macro processor does not
interpret them as macro-level syntax. That is, the %STR function hides the normal meaning of a semicolon and other
special tokens and mnemonic equivalents of comparison or logical operators so that they appear as constant text.
In this example, without the %STR function, SAS would read the apostrophe as a single quote and scan for the second,
closing quote.
Note: You can achieve the same result as option (D) with the following syntax:
%LET NAME=Patel%STR(%)s Restaurant;
72.
(C) When evaluating missing values as part of a WHERE clause in PROC SQL, you must invoke the IS condition. The
syntax is as follows:
Sql-expression IS <NOT> NULL | MISSING
Note: In addition to option (C), the following clause would have accomplished the same feat:
WHERE Salary IS NOT NULL;
73.
74.
(C) The COMPRESS=YES data set option is particularly useful when your data set contains many values that have
repeated characters or binary zeros.
In character data, the most frequently encountered repeated value is the blank. Long text fields, such as comments
and addresses, often contain repeated blanks.
75.
(A) The MERGE statement in SAS joins two or more SAS data sets into a single observation. In this instance, none of
the BY variable values match, so the observations will be interleaved with each other, resulting in missing values
for each observation in the new table in either the NAME or SALARY column.
The method to achieve a similar result in PROC SQL is the FULL JOIN. A full outer join retrieves both matched rows
and nonmatching rows from both tables.
Because both tables contain the column ID, you need to implement the COALESCE function. The syntax is as follows:
SELECT COALESCE(column-1<,column-n>) <<AS> column-alias>
<,column-1<,column-n>>
Where column-1 through column-n are the names of two or more columns to be overlaid. The COALESCE function requires
that all arguments have the same data type.
Column-alias is a temporary name for the coalesced column. The alias cannot contain any spaces. If another clause in
the SELECT statement, such as an ORDER BY clause, references the coalesced column, a column alias must be specified.
76.
(C) PROC DATASETS is a SAS procedure used to manage data sets. The CONTENTS statement in PROC DATASETS allows you to
view the descriptor portion of a data set.
_ALL_ is a special SAS name list that, when used in place of the SAS-data-set-name, lists all data sets within the
identified library with the libref.
Note: You may also use the CONTENTS procedure to accomplish the same task.
77.
(A) The SAS REUSE= system option and the REUSE= data set option specify whether or not SAS reuses space when
observations are added to a compressed data set. If you set the REUSE= data set option to YES in a DATA statement,
SAS tracks and reuses space in the compressed data set that is created in that DATA step.
78.
(D) The character operand + is found within the %EVAL function. This produces a null result because the %SYSEVALF
function is the only macro function that can evaluate arithmetic or logical expressions using floating point or
missing values.
Imitate the following to correct the code:
%LET NEWVAL=%SYSEVALF(&VALUE + &ADD);
The resulting value of the macro variable NEWVAL would be the expected 5.5.
79.
(A) When you specify multiple tables in the FROM clause but do not include a WHERE statement to subset data, PROC SQL
returns the Cartesian product of the tables. In a Cartesian product, each row in the first table is combined with
every row in the second table.
80.
(D) In addition to a DATA step, you can also create or update macro variables during the execution of a PROC SQL
step. Remember that the SELECT statement in a PROC SQL step retrieves and displays data.
81.
82.
It
It
It
It
writes
writes
has no
echoes
the original program code inside the macro definition to the SAS log
the macro execution messages to the SAS log
effect in this example
the text sent to the SAS compiler as a result of macro execution in the SAS log
In which one of the following SAS programs is the SAS data set index named CHAR1 always used?
A. PROC SQL;
CREATE TABLE THREE AS
SELECT *
FROM ONE, TWO
WHERE ONE.CHAR1 > TWO.CHAR1;
QUIT;
B. DATA THREE;
SET ONE;
SET TWO KEY=CHAR1;
RUN;
C. DATA THREE;
SET ONE;
WHERE CHAR1 IN(New York Los Angeles);
RUN;
D. DATA THREE;
SET ONE;
IF CHAR1 IN(New York Los Angeles);
RUN;
83.
84.
LIST TABLE
DESCRIBE TABLE
CREATE TABLE
VALIDATE TABLE
85.
MLOGIC
SOURCE2
MSOURCE
MPRINT
86.
Metadata
Metadata
Metadata
Metadata
on
on
on
on
all
all
all
all
tables
tables
tables
tables
in
in
in
in
the
the
the
all
COST
---200
400
100
600
100
87.
TOTAL
----13
15
25
Which BY statement completes the data step and successfully generates the desired output?
A.
B.
C.
D.
88.
BY
BY
BY
BY
DATE
DATE
DATE
DATE
GROUPFORMAT;
NOTSORTED;
QTR;
FORMATTED;
89.
Any
Any
Any
Any
2,500,000
10
and 1
and 2,500,000
90.
%IF
%IF
%IF
%IF
&SYSDAY
&SYSDAY =
&SYSDAY =
&SYSDAY
81.
(D) The macro program TEST is created with a positional parameter called PARM. When the macro program TEST is called,
it replaces the positional parameter with PRINT and during execution of the macro, PRINT replaces the macro variable
&PARM for a final result of PROC PRINT.
When the MPRINT option is specified, the text that is sent to the SAS compiler as a result of macro execution is
printed to the SAS log.
You may want to specify the MPRINT system option if: you have a SAS syntax error or execution error, or you want to
see the generated SAS code.
In this example, the printed text to the SAS log would appear as follows:
MPRINT(TEST): PROC PRINT DATA=SASHELP.PRDSALE;
MPRINT(TEST): RUN;
82.
(B) You can use multiple SET statements to combine data from multiple data sets if you want to combine only data from
observations that have matching values for particular variables.
To do this, you specify the KEY= option in the SET statement to use an index to retrieve observations from the input
data set that have key values equal to the key variable value that is currently in the program data vector (PDV).
The syntax is as follows:
SET SAS-data-set-name KEY=index-name;
Where index-name is the name of an index that is associated with the SAS-data-set-name data set.
83.
(B) The DESCRIBE TABLE statement writes a CREATE TABLE statement to the SAS log for the table specified in the
DESCRIBE TABLE statement, regardless of how the table was originally created (for example, with a DATA step). If
applicable, SAS data set options are included with the table definition. If indexes are defined on columns in the
table, then CREATE INDEX statements for those indexes are also written to the SAS log.
To create the example generated output, imitate the following:
PROC SQL;
DESCRIBE TABLE SASHELP.CLASS;
QUIT;
84.
(D) When the MPRINT option is specified, the text that is sent to the SAS compiler as a result of macro execution is
printed to the SAS log.
You may want to specify the MPRINT system option if: you have a SAS syntax error or execution error, or you want to
see the generated SAS code.
85.
(D) The DICTIONARY.TABLES table contains detailed information about tables. Dictionary column names are specified in
the SELECT statement and the Dictionary table name, DICTIONARY.TABLES, is specified in the FROM clause.
In this example, the asterisk (*) selects all column names for all tables in SAS.
If you want to specify a particular library instead of all libraries, you must specify the library name in uppercase
letters with a WHERE clause and enclose it in quotation marks. For example, to select all columns from just the WORK
library:
PROC SQL;
SELECT *
FROM DICTIONARY.TABLES
WHERE LIBNAME=WORK;
QUIT;
(B) Notice that the PROC SQL will have two variables in the output (REP and AVERAGE) as a result of the SELECT
statement.
The next thing to notice is that this program is going to group values in the REP column together (SMITH and JONES).
A HAVING clause works with the GROUP BY clause to restrict the groups that are displayed in the output, based on one
or more specified conditions.
In this example, we have our grouped values (SMITH and JONES), and the output will depend on whether or not those
groups meet a specified condition.
The AVERAGE value for the SMITH group is 400. The AVERAGE value for the JONES group is 100. The average of the COST
variable for all observations in data set ONE is 280.
So, in order to print just the SMITH group with its AVERAGE value, you can apply the following clause:
HAVING AVG(COST) > (SELECT AVG(COST) FROM ONE);
Note: The WHERE clause cant process calculated variables and is invalid.
87.
(A) First, notice the FORMAT statement. It assigns a format of QTR. (which must have been previously created as part
of a FORMAT procedure) to the variable DATE.
When the GROUPFORMAT option is used, the data set must be sorted by the GROUPFORMAT variable or grouped by the
formatted values of the GROUPFORMAT variable.
The GROUPFORMAT option uses the formatted values of a variable instead of the internal values to determine where a BY
group begins and ends, and how FIRST.variable and LAST.variable are computed. The syntax is as follows:
BY variable(s) GROUPFORMAT;
Where variable(s) names each variable by which the data set is sorted or indexed.
88.
(A) The CEIL function returns the smallest integer that is greater than or equal to the argument, fuzzed to avoid
unexpected floating-point results. The syntax is as follows:
CEIL (argument)
Where argument specifies a numeric constant, variable, or expression.
You can use the CEIL function in conjunction with the RANUNI function to generate a random integer.
The CEIL function returns the smallest integer that is greater than or equal to the argument. Therefore, if you apply
the CEIL function to the result of the RANUNI function, you can generate a random integer.
With this knowledge, you can look at the assignment statement that creates the variable PTOBS. TOTOBS is a variable
equal to the total number of observations in the data set. The data set is described as having 2.5 million
observations so PTOBS can be any random integer between 1 and 2,500,000.
89.
(C) SAS creates and defines several automatic macro variables for you. Automatic macro variables contain information
about your computing environment, such as the date and time of the session, and the version of SAS you are running.
These automatic variables: are created when SAS is invoked, are global (always available), are usually assigned
values by SAS, and can be assigned values by the user in some cases.
SYSDAY is one such automatic SAS macro variable with a value equal to the day of the week of the SAS invocation.
In this example, options (A) and (D) can be excluded because no quotes should be placed around macro variables.
Option (B) can be excluded because all macro variables are character strings, therefore it is unnecessary to quote
the value Tuesday.
What this program does is, when the macro program EXECUTE is called, it executes the program. It resolves the value
of &SYSDAY, and if that value is equal to Tuesday then the PRINT procedure is executed.
90.
(C) The TAGSORT option can be used to sort a large data set. The TAGSORT option stores only the BY variables and the
observation numbers in temporary files. The BY variables and the observation numbers are called tags. At the
91.
92.
The
The
The
The
value
value
value
value
is
is
is
is
&DEPT
&&DEPT;
&&&DEPT;
%QUOTE(&&&DEPT);
What is generated as a result of submitting the RANUNI function with a seed of 123?
A.
B.
C.
D.
93.
%PUT
%PUT
%PUT
%PUT
A
A
A
A
94.
DEPT=%STR(research&development);
DEPT=%NRSTR(research&development);
DEPT=%STR(research%&development);
DEPT=%NRSTR(research%&development);
95.
%LET
%LET
%LET
%LET
The
The
The
The
WHERE statement selects observations before they are brought into the PDV
WHERE statement can be executed conditionally as part of an IF statement
subsetting IF statement works on observations before they are read into the PDV
WHERE and subsetting IF statements can be used interchangeably in all SAS programs
Which one of the following should be avoided when creating and using an SQL procedure view?
A.
B.
C.
D.
97.
%LET
%LET
%LET
%LET
CODENUM=SUBSTR(&IDCODE, LENGTH(&IDCODE)-3);
CODENUM=%SUBSTR(&IDCODE, %LENGTH(&IDCODE)-3);
CODENUM=%SUBSTR(&IDCODE, %LENGTH(&IDCODE)-2);
CODENUM=SUBSTR(&IDCODE, LENGTH(&IDCODE)-2);
The variable attributes of SAS data sets ONE and TWO are given below:
#
2
1
1
ONE
VARIABLE TYPE LEN POS
-------- ---- --- --SALES
NUM
8
8
YEAR
NUM
8
0
YEAR
NUM
8
0
#
2
3
TWO
VARIABLE TYPE LEN POS
-------- ---- --- --BUDGET
NUM
8
8
SALES
CHAR
8 16
Data set ONE contains 100 observations. Data set TWO contains 50 observations. Both data sets are sorted by the
variable YEAR.
The following SAS program is submitted:
DATA THREE;
MERGE ONE TWO;
BY YEAR;
RUN;
Which one of the following is the result of the program execution?
A.
B.
C.
D.
98.
SAS log
two variables and 50 observations
written to the SAS log
three variables and 100 observations
The SAS data sets ONE and TWO are given below:
ONE
NUM CHAR1
--- ----1
A1
1
A2
2
B1
2
B2
4
D
TWO
NUM CHAR2
--- ----2
X1
2
X2
3
Y
5
V
The following SAS program is submitted creating the output table THREE:
PROC SQL;
CREATE TABLE THREE AS
SELECT ONE.NUM, CHAR1, CHAR2
FROM ONE, TWO
WHERE ONE.NUM=TWO.NUM;
QUIT;
NUM
--2
2
2
2
THREE
CHAR1
----B1
B1
B2
B2
CHAR2
----X1
X2
X1
X2
Which one of the following DATA step programs creates an equivalent SAS data set THREE?
A. DATA THREE;
SET ONE;
DO i=1 TO NUMOBS;
99.
10
MILD
WARM
BELOW FREEZING
100. The SAS data set TEMP has the following distribution of values for variable A:
A
1
2
6
8
FREQUENCY
--------500,000
500,000
7,000,000
3,000
Which one of the following SAS programs requires the least CPU time to be processed?
A. DATA NEW;
SET TEMP;
IF A=8 THEN b=SMALL;
ELSE IF A IN(1,2) THEN B=MEDIUM;
ELSE IF A=6 THEN B=LARGE;
RUN;
B. DATA NEW;
SET TEMP;
IF A IN(1,2) THEN B=MEDIUM;
ELSE IF A=8 THEN B=SMALL;
91.
(C) You can immediately dismiss option (D) because the %QUOTE function masks special characters and mnemonic
operators in a resolved value at macro execution, it doesnt put quotation marks around a character string.
The other three options simply involve properly resolving the macro variable to the appropriate value.
Refer to the explanations for 57 and/or 67 if you need a refresher on how to do that.
92.
(C) In order to create a random sample, you need to generate a random number. SAS provides several random number
functions to generate random numbers from various distributions. One such example is the RANUNI function.
RANUNI (seed)
Where seed is a nonnegative integer with a value less than 231-1 (2,147,483,647)
The RANUNI function generates streams of random numbers from an initial starting point, called the seed. If you use a
positive seed, you can always replicate the stream of random numbers by using the same data step. If you use 0 as the
seed, the computer clock initializes the stream, and the stream of random numbers is not replicable.
Therefore, because this example is used with a seed of 123, there is a consistent sequence.
93.
(B) First, notice that a macro variable called DEVELOPMENT with a value of ontime has been created via a LET
statement.
The question requires that TITLE1 print a value that includes an ampersand (&) with the word development immediately
after. Without any addition to the code, that title would resolve to For researchontime.
Sometimes you might want to hide the normal meaning of an ampersand or a percentage sign. The %NRSTR function
performs the same quoting functions %STR, except it also masks macro triggers (& and %). The NR in the name %NRSTR
stands for No Resolution.
94.
(A) The WHERE statement examines what is in the input page buffer and selects observations before they are loaded in
the program data vector, which results in a savings in CPU operations.
95.
(D) SAS executes a view each time it is referenced, even within one program. Therefore, if data is used many times in
one program, it is more efficient to create and reference a temporary SAS data file than to create and reference a
view.
96.
(C) When referencing a macro function within a LET statement, the percentage sign (%) must be used. Therefore, you
can immediately eliminate options (A) and (D).
The %SUBSTR function enables you to extract part of a character string from the value of a macro variable. The syntax
is as follows:
%SUBSTR (argument, position<,n>)
Where argument is a character string or a text expression from which a substring will be returned.
97.
(C) This program produces error and warning messages because when it attempts to overlay the variable SALES, SALES is
a numeric variable in data set ONE and a character variable in data set TWO. In order to merge, variables of the same
name must also be of the same type.
98.
(A) In the example, the CREATE TABLE statement creates a table (data set) named THREE and populates the variables
from the SELECT statement via the AS keyword.
The result is an INNER JOIN based on the conditions in the WHERE statement which output a Cartesian product of four
total observations where the values in the NUM column are all equal to 2.
The DATA step that replicates this output is option (A).
99.
100. (C) Because the value 6 is the most prevalent, it is most likely that for any given observation of variable A, the
value will be 6. Therefore, it is most efficient to first evaluate an IF statement assuming the first value is 6.
This eliminates options (A) and (B) immediately.
The next thing to do is assign values to the next largest frequency values (1 and 2). Both options (C) and (D) do
this, but the use if the ELSE statements allows SAS to accomplish this in one sweep.
Therefore, option (C) is most efficient in terms of computer processing.
SALES
----1234
3654
5678
1234
SALES
5678
NULL
102. The SAS data set ONE has a variable, X, on which an index has been created.
The data sets ONE and THREE are sorted by X.
Which one of the following SAS programs uses the index to select observations from the data set ONE?
A. DATA TWO;
SET THREE;
SET ONE KEY=X;
RUN;
B. DATA TWO;
SET THREE KEY=X;
SET ONE;
RUN;
C. DATA TWO;
SET ONE;
SET THREE KEY=X;
RUN;
1900
1920
1950
2000
2
3
5
6
CITY
VISIT
------ ----BOSTON 10
LONDON
5
DALLAS 10
MARLOW 10
BOSTON 20
LONDON 15
DALLAS 10
CITY
TOTAL
------ ----MARLOW 10
LONDON 20
BOSTON 30
DALLAS 20
B. COUNTRY
------UK
UK
USA
USA
CITY
TOTAL
------ ----LONDON 20
MARLOW 10
BOSTON 30
DALLAS 20
C. COUNTRY CITY
TOTAL
------- ------ ----USA
BOSTON 30
D. COUNTRY
------UK
UK
USA
USA
CITY
TOTAL
------ ----MARLOW 10
LONDON 20
DALLAS 20
BOSTON 30
The
The
The
The
hash
hash
hash
hash
object
object
object
object
107. Which one of the following automatic SAS macro variables contains the return code from a previously executed step?
A.
B.
C.
D.
&RC
&ERR
&SYSRC
&SYSERR
AGE
--28
25
18
25
SALARY
-----200
100
100
200
BONUS
----.
10
50
10
EARNINGS
-------200
110
150
210
B. CATEGORY
-------M
M
F
F
EARNINGS
-------.
110
150
210
C. CATEGORY
-------M
M
F
F
SALARY
-----200
100
100
200
BONUS
----.
10
50
10
EARNINGS
-------200
110
150
210
D. CATEGORY
-------M
M
M
M
F
F
SALARY
-----200
100
200
100
100
200
BONUS
----.
10
.
10
50
10
EARNINGS
-------.
110
200
110
150
210
_ERROR_
20 (As a numeric)
20 (As a character)
. (Missing numeric)
110. Which of the following statements correctly creates a DATA step variable named Price and assigns to it the value of
the macro variable daily_fee during DATA step execution?
A.
B.
C.
D.
price=&daily_fee;
price=symget(daily_fee);
price=symget(&daily_fee);
price=symget(daily_fee);
101. (B) When you use the DATA _NULL_ statement, SAS processes the DATA step without writing observations to a data set.
Using the DATA _NULL_ statement can considerably increase program efficiency.
The BY statement in a DATA STEP applies only to the SET, MERGE, or UPDATE statement that precedes it in the DATA
step, and only one BY statement can accompany each of these statements in a DATA step.
The data sets that are listed in the SET, MERGE, or UPDATE statements must be sorted by the values of the variables
that are listed in the BY statement or have an appropriate index. As a default, SAS expects the data sets to be
arranged in ascending numeric order or in alphabetical order.
102. (A) You can use multiple SET statements to combine data from multiple data sets if you want to combine only data from
observations that have matching values for particular variables.
You specify the KEY= option in the SET statement to use an index to retrieve observations from the input data set
that has key values equal to the key variable value that is currently in the program data vector (PDV).
Note: To use the SET statement with the KEY= option to perform a lookup operation, your lookup values must be stored
in a SAS data set that has an index. This technique is only appropriate when you are working with one-to-one matches,
and you can use it with a lookup table of any size. It is possible to return multiple values with this technique, and
you can use other DATA step syntax with it as well.
103. (D) The _NULL_ data set doesnt write anything to a SAS data set, but it does execute. In its execution it creates a
data set variable called DATE with a numeric value that is equal to the number of days since January 1, 2000 (14610).
It then, using the CALL SYMPUT routine, creates a global macro variable called DATE and assigns a value the same as
the data set variable DATE (14610).
%Y2KOPT(&DATE); calls the Y2KOPT macro and applies the newly created DATE macro variable. It matches the 14610 within
the %IF/%THEN and gets applied on the first iteration of the DO loop with a YEARCUTOFF of 2000.
Note: If the data set variable DATE had instead been given a value of 31DEC1999D then the YEARCUTOFF would have
instead been 1900.
104. (D) When a lookup operation depends on more than one numerical factor, you can use a multidimensional array. The
syntax is as follows:
ARRAY array-name {rows,cols} <$> <length>
<array-elements> <(initial values)>;
As you can see from the question, the array POINTS is assigned two rows and three columns for a total of six
elements.
Note: The keyword _TEMPORARY_ may be used instead of array-elements to avoid creating new data set variables. Only
temporary array elements are produced as a result of using _TEMPORARY_.
105. (B) The first thing SAS does is make use of the FROM clause and access the data set ONE. The next thing it does is
extract the variables COUNTRY and CITY, then creates a new variable called TOTAL.
The GROUP BY clause is used in queries that include one or more summary functions. Summary functions produce a
statistical summary for each group that is defined in the GROUP BY clause.
So, first the table is grouped by country. After that initial grouping, it is grouped again by city. From this point,
the variable TOTAL displays the value of the sum of each of these groups visit.
The ORDER BY clause then sorts the rows that the query returns by the value(s) of the specified column(s).
First, these groups are sorted by the variable COUNTRY. By default, they are sorted in ascending order. So, UK comes
before USA. Then are then sorted further by TOTAL in descending order. Thats why, for each group, the highest TOTAL
is listed first.
Note: If the keyword DESC had not been utilized, TOTAL would have sorted (after COUNTRY) in ascending order. This
would have resulted in the flip-flop of LONDON 20 with MARLOW 10 and BOSTON 30 with DALLAS 20.
107. (D) SAS creates and defines several automatic macro variables. Automatic macro variables contain information about
your computing environment, such as the date and time of session, and the version of SAS you are running.
Some automatic variables have values that automatically change based on submitted SAS statements.
SYSERR is one such automatic variable that contains a return code status that is set by the DATA step and some SAS
procedures to indicate if the step or procedure executed successfully.
108. (B) The addition sign (+) acts as an operator to perform a calculation between to variable values (SALARY and BONUS).
However, when you use an arithmetic expression (+, -, *, /), the SQL procedure always sets the result of the
expression to missing (.). If you use that result in another expression, the next result will be valued as missing
(.) as well.
Note: This method of treating missing values is called propagation of missing values.
109. (B) In data set TWO the variable Y is assigned a character value of 2. Additionally, via the %LET statement, there is
a global macro variable called VAR with a value of Y.
The data step, which creates the data set ONE, has a KEEP= option on the SET statement which includes the macro
variable VAR which resolves to Y. This instructs the input data set to keep the Y variable from data set TWO.
The Z variable is then created by multiplying the values of two macro variables which are considered character
values. SAS, though, is able to temporarily convert these values to numeric in order to perform the required
operation.
110. (D) The SYMGET function returns the value of an existing macro variable.
SYMGET(macro-variable)
Where macro-variable can be specified as one of the following: a macro variable name (enclosed in quotation marks), a
DATA step variable name whose value is the name of a macro variable, or a DATA step character expression whose value
is the name of a macro variable
BONUS
BONUS
BONUS
BONUS
ORDEREDBY=X
GROUPBY=X
SORTEDBY=X
SORTSYNC=X
114. The SAS data sets ONE and TWO are given below:
ONE
NUM CHAR1
--- ----1
A
TWO
NUM CHAR2
--- ----2
X
B
D
3
5
Y
V
The following SAS program is submitted; creating the output table THREE.
DATA THREE;
SET ONE TWO;
RUN;
SUM
--30
40
116. When is it appropriate to create indexes on a SAS data set for efficient processing?
A.
B.
C.
D.
If
If
If
If
A
A
A
A
is
is &A
is cat
is dog
ANIMAL AGE
------ --Cat
9
Dog
22
Pig
1
The
The
The
The
value
value
value
value
is
is
is
is
Dog
animal2
Brown
&animal2
119. Which one of the following statements is true regarding the TRANSPOSE procedure?
A.
B.
C.
D.
The
The
The
The
TRANSPOSE
TRANSPOSE
Transpose
TRANSPOSE
procedure
procedure
procedure
procedure
120. Which SAS system option is used to identify format catalogs to SAS?
FMTERR
FMTLIB
NOFMTERR
FMTSEARCH=
111. (D) When you use a column alias in the WHERE clause to refer to a calculated value, you must use the keyword
CALCULATED along with the alias. The CALCULATED keyword informs PROC SQL that the value is calculated within the
query.
112. (A) The question asks which variables are written to the SAS log. The only variables that will be written to the SAS
log are those which are user-generated global macro variables due to the %PUT _GLOBAL_; statement.
COMPANY will be written to the SAS log because it was created via a %LET statement outside of a macro program which
makes it a global macro.
DEPT will also be written to the SAS log because it was created in a data step via the CALL SYMPUT routine.
COUNTRY, however, was created within the macro program and is therefore a local macro variable.
Note: DEPT could only be created if its macro program was executed. If the macro LOCATION had not been called via
%LOCATION, then the only variable in the log would have been COMPANY.
113. (C) If youre working with input data that is already sorted, you can specify how the data is ordered by using the
SORTEDBY= data set option.
SORTEDBY=by-clause </collate-name> | _NULL_
Where by-clause indicates the data order. collate-name names the collating sequence that is used for the sort. _NULL_
removes any existing sort information.
Note: Although the SORTEDBY= option does not sort a data set, it sets the value of the Sorted flag.
114. (A) The set operator OUTER UNION concatenates the results of the queries by: selecting all rows (both unique and
nonunique) from both tables, and not overlaying columns.
When two or more tables are being joined via OUTER JOIN and they contain two columns with the same name, the CORR
keyword may be utilized to overlay the columns.
115. (B) If you need to reference a macro variable within quotation marks, you must use double quotation marks. The macro
processor will not resolve macro variable references that appear within single quotation marks.
Note: Because of the aforementioned information, the macro processor does not resolve &LOC. So, basically SAS is
told to retrieve values of LOCATION that are equal to &LOC. Because there are none, no report is generated.
116. (A) An index can help you quickly locate one or more particular observations that you want to read. An index is an
optional file that you can create for a SAS data set in order to specify the location of observations based on values
of one or more key variables.
Indexes can provide direct access to observations in SAS data sets to: yield faster access to small subsets of
observations for WHERE processing, return observations in sorted order for BY processing, and perform table lookup
operations.
117. (D) Initially, the global macro variable A is assigned a value of cat, and a macro called ANIMAL is created. When
ANIMAL is called, its execution creates what otherwise would be a local macro variable. However, because this
variable has the same name as the global macro variable (A), it overwrites its value with dog. Therefore, when the
macro variable A is resolved in the %PUT statement, the value is now dog.
If %LET A=cat had been written anywhere after the macro call, it would have resolved instead to cat.
119. (D) The TRANSPOSE procedure creates an output data set by restructuring the values in a SAS data set. When the data
set is restructured, selected variables are transposed into observations
120. (D) By default, SAS searches for custom formats in the Work and Library libraries. The FMTSEARCH= system option
specifies other catalogs to search when a format is referenced.
121. The data sets ONE and TWO are given below:
YEAR
---2001
2001
2002
ONE
QTR
--3
4
1
BUDGET
-----500
400
350
YEAR
---2001
2002
TWO
QTR
--4
1
SALES
----300
600
QTR
--4
4
1
SALES
----300
300
600
BUDGET
----500
400
350
Which JOIN operator completes the program and generates the desired output?
A.
B.
C.
D.
FULL JOIN
INNER JOIN
LEFT JOIN
RIGHT JOIN
122. The data sets ONE and TWO are given below:
ONE
YEAR
---2001
2001
2003
QTR
--3
4
1
BUDGET
-----300
500
350
TWO
YEAR
---2001
2002
QTR
--4
4
SALES
----300
600
QTR
--4
4
4
SALES
----300
300
600
BUDGET
-----300
500
.
Which JOIN operator completes the program and generates the desired output?
A.
B.
C.
D.
FULL JOIN
LEFT JOIN
RIGHT JOIN
INNER JOIN
121. (A) A full outer join retrieves both matching rows and nonmatching rows from both tables
The ON keyword specifies join condition(s), which are expression(s) that specify the column or columns on which the
tables are to be joined. Both the WHERE and ON keywords serve the same purpose. The both subset the Cartesian product
of the input files.
In this example, the SELECT statement aligns the output with the variables YEAR, QTR, SALES from data set TWO, as
well as BUDGET from data set ONE in that order.
The FULL JOIN, with the data set TWO being named second, indicate that the values in matching columns which satisfy
the ON keyword will overwrite those of data set ONE.
So, observation 1 in each data set matches on YEAR=2001, QTR is written with the value 4, SALES is unique to the
observation so 300 is used, as well as 500 from BUDGET.
Observation 2 from data set ONE matches with observation 1 from data set TWO. So, YEAR=2001, QTR is written with the
value of the matching observation from data set TWO, SALES is written with the value from the matching observation in
data set TWO, and BUDGET is written with the value in observation 2 of data set ONE.
The same logic applies to the remaining output observation.