Select the best answer
for each question. After completing the quiz, check your answers using
the answer key in the appendix.
-
Which of the following
is false?
-
A %LET statement causes
the macro processor to create a macro variable before the program
is compiled.
-
To create a macro variable
that is based on data calculated by the DATA step, you use the SYMPUT
function.
-
Macro functions are
always processed during the execution of the DATA step.
-
Macro variable references
in a DATA step are always resolved before DATA step execution.
-
Which of the following
correctly creates a macro variable named
region
and
assigns to it a value that is based on the value of the data set variable
Location
?
-
data new;
set sasuser.all;
if location='Boston' then do;
call symput('region', 'East'),
end;
else do;
call symput('region', 'West'),
end;
run;
-
data new;
set sasuser.all;
if location='Boston' then do;
%let region=East;
end;
else
%let region=West;
end;
run;
-
data new;
set sasuser.all;
if location='Boston' then do;
call symput(region, "East");
end;
else
call symput(region, "West");
end;
run;
-
data new;
set sasuser.all;
if location='Boston' then do;
symput(region, East);
end;
else
symput(region, West);
end;
run;
-
The SYMPUT routine cannot
-
be used to assign a
data set variable as a value to a macro variable.
-
create a series of macro
variables in one DATA step.
-
automatically convert
a numeric value to a character value when used to assign a value to
a macro variable in a DATA step.
-
be used to assign a
numeric value to a macro variable in an SCL program.
-
Which of the following
programs correctly creates a series of macro variables whose names
are values of the data set variable
Course_code
,
then indirectly references one of those macro variables in a later
step?
-
data _null_;
set sasuser.courses;
call symput(course_code, trim(course_title));
%let crsid=C005;
proc print data=sasuser.schedule noobs label;
where course_code="&crsid";
var location begin_date teacher;
title1 "Schedule for &c005";
run;
-
data _null_;
set sasuser.courses;
call symput(course_code, trim(course_title));
run;
%let crsid=C005;
proc print data=sasuser.schedule noobs label;
where course_code="&crsid";
var location begin_date teacher;
title1 "Schedule for &&&crsid";
run;
-
data _null_;
set sasuser.courses;
call symput('course_code', trim(course_title));
run;
%let crsid=C005;
proc print data=sasuser.schedule noobs label;
where course_code="&crsid";
var location begin_date teacher;
title1 "Schedule for &&&crsid";
run;
-
data _null_;
set sasuser.courses;
call symget(course_code, trim(course_title));
run;
%let crsid=C005;
proc print data=sasuser.schedule noobs label;
where course_code="&crsid";
var location begin_date teacher;
title1 "Schedule for &&&crsid";
run;
-
Which of the following
statements about the resolution of macro variable references is false?
-
Two ampersands resolve
to one ampersand.
-
If more than four consecutive
ampersands precede a name token, the macro processor generates an
error message.
-
Re-scanning continues
until there are no remaining macro triggers that the macro processor
can resolve.
-
The macro processor
always re-scans a name token that is preceded by multiple ampersands
or by multiple percent signs.
-
In which of the following
situations would you use SYMGET rather than a macro variable reference
(
&macvar
)?
-
to create a DATA step
variable from a macro variable value during the execution of the DATA
step
-
to include a macro variable
reference in a PROC SQL view
-
to access the value
of a macro variable during the execution of an SCL program
-
-
Which of the following
correctly creates a macro variable in a PROC SQL step?
-
call symput(daily_fee, put(fee/days, dollar8.);
-
%let daily_fee=put(fee/days, dollar8.)
-
select fee/days format=dollar8.
into :daily_fee from sasuser.all;
-
select fee/days format=dollar8.
into daily_fee from sasuser.all;
-
According to the global
symbol table shown here, what is the resolved value for a reference
to
&&teach&crs
?
-
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?
-
-
-
price=symget(&daily_fee);
-
price=symget("daily_fee");
-
Which of the following
is false?
-
The SYMPUT routine can
be used to create a macro variable during execution of the DATA step
or during execution of an SCL program.
-
In the DATA step, the
SYMPUT routine automatically converts to a character value any numeric
value that you attempt to assign as the value of a macro variable.
-
PROC SQL automatically
converts to a numeric value any macro variable value that you attempt
to compare to a numeric value.
-
In an SCL program, the
SYMPUTN routine can be used to assign a numeric value to a macro variable.