SAS Advanced Programming
d
An index a. is an optional file that is associated with a data set. b. provides direct access to specific observations of a data set, based on the value of one or more key variables. c. can be classified as simple or composite, either of which can consist of unique values. d. all of the above.
c
If you specify a CREATE TABLE statement in your PROC SQL step, a. the results of the query are displayed, and a new table is created. b. a new table is created but it does not contain any summarization that was specified in the PROC SQL step. c. a new table is created, but no report is displayed. d. results are grouped by the value of the summarized column.
d
Dictionary tables are a. created each time they are referenced in a SAS program. b. updated automatically. c. limited to read-only access. d. all of the above
d
Dictionary tables can be accessed a. by running a PROC SQL query against the table, using the Dictionary libref. b. by referring to the PROC SQL view of the table that is stored in the Sashelp library. c. by referring to the PROC SQL view of the table that is stored in the Sasuser library. d. a and b
a
How many statements does the program below contain? proc sql; select grapes, oranges, grapes + oranges as sumsales from sales.produce order by sumsales; a. two b. three c. four d. five
a
If the value of Cargosum is $1000 at the end of the first iteration of the DATA step shown below, what is the value of Cargo sum in the PDV when the DATA step is in its third iteration? data sasuser.percent1; if _n_=1 then set sasuser.summary (keep=cargosum); set sasuser.monthsum(keep=salemon revcargo); PctTev=revcargo/cargosum; run; a. $1000 b. $3000 c. the value is missing d. the value cannot be determined without seeing the data that is in Sasuser.Summary
b
Placing the subsetting IF statement at the top rather than near the bottom of a DATA step results in savings in CPU usage. What happens if the subset is large rather than small? a. The savings in CPU usage increases as the subset grows larger because the I/O increases. b. The savings in CPU decreases as the subset grows larger. However, placing the subsetting IF statement at the top of a DATA step always uses fewer resources than placing it at the bottom. c. The savings in CPU usage remains constant as the subset grows larger. However, placing the subsetting IF statement near the bottom of a data set is preferable. d. The savings in CPU usage decreases as the subset grows larger. However, placing the subsetting IF statement near the bottom of a data set increases the I/O.
a
A Cartesian product is returned when a. join conditions are not specified in a PROC SQL join. b. join conditions are not specified in a PROC SQL set operation. c. more than two tables are specified in a PROC SQL join. d. the keyword ALL is used with the OUTER UNION operator.
d
A Dictionary table contains a. information about SAS data libraries. b. information about SAS data sets. c. information about SAS macros. d. all of the above
c
A public library has several categories of books. Each book in the library is assigned to only one category. The table Library.Inventory contains one row for each book in the library. The Checkouts column indicates the number of times that each book has been checked out. You want to display only the categories that have an average circulation (number of checkouts) that is less than 2500. Does the following PROC SQL query produce the results that you want? proc sql; title 'Categories with Average Circulation'; title2 'Less than 2500'; select category, avg(checkouts) as AvgCheckouts from library.inventory having avg(checkouts) < 2500 order by 1; a. No. this query will not run because a HAVING clause cannot contain a summary function. b. No. This query will not run because the HAVING clause must include the CALCULATED keyword before the summary function. c. No. Because there is no GROUP BY clause, the HAVING clause treats the entire table as one group. d. Yes.
d
Assuing that you began your SAS session today, which of the following statements correctly sets the macro variable currdate to today's date: a. %let currdate = %sysfunc(today(), worddate.); b. %let currdate = &sysdate9; c. %let currdate = %sysfunc(date()); d. all of the above
c
By definition, a noncorrelated subquery is a nested query that a. returns a single value to the outer query. b. contains at least one summary function. c. executes independently of the outer query. d. requires only a single value to be passed to it by the outer query.
b
Complete the SELECT clause below to create a new column named Profit by subtracting the values of the column Cost from those of the column Price. select fruit, cost, price, ______________ a. Profit=price-cost b. price-cost as Profit c. profit=price-cost d. Profit as price-cost
b
Complete the following PROC SQL query to select the columns Address and SqFeet from the table List.Size and to select Price from the table List.Price. (Only the Address column appears in both tables.) proc sql; _______________ from list.size,list.price; a. select address, sqfeet, price b. select size.address, sqfeet, price c. select price.address, sqfeet, price d. either b or c
c
Consider the following PROC SQL query: proc sql; select lastname, firstname, total, since from charity.donors where not exists (select lastname from charity.current where donors.lastname = current.lastname); The query references two tables: -Charity.Donors lists name and contact information for all donors who have made contributions since the charity was founded. The table also contains these two columns: Total, which shows the total dollars given by each donor, and Since, which stores the first year in which each donor gave money. -Charity.Current lists the names of all donors who have made contributions in the current year, and the total dollars each has given this year (YearTotal). Assume that the values of LastName are unique in both tables. The output of this query displays a. all donors whose rows do not contain any missing values. b. all donors who made a contribution in the current year. c. all donors who did not make a contribution in the current year. d. all donors whose current year's donation in Charity.Current has not yet been added to Total in Charity.Donors.
c
Consider this PROC SQL query: proc sql; select flightnumber, count(*) as Flights, avg(boarded) label="Average Boarded" format=3. from sasuser.internationalflights group by flightnumber having avg(boarded) > 150; The table Sasuser.Internationalflights contains 201 rows, 7 unique values of FlightNumber, 115 unique values of Boarded, and 4 different flight numbers that have an average value of Boarded that is greater than 150. How many rows of output will the query generate? a. 150 b. 7 c. 4 d. 1
d
For selecting observations, is a subsetting IF statement or a WHERE statement more efficient? Why? a. A subsetting IF statement is more effective because it loads all observations sequentially into the program data vector. b. A subsetting IF statement is more efficient because it examines what is in the input buffer and selects observations before they are loaded into the program data vector, which results in a savings in CPU operations. c. A WHERE statement is more efficient because it loads all observations sequentially into the program data vector. d. A WHERE statement is more efficient because it examines what is in the input buffer and selects observations before they are loaded into the program data vector, which results in a savings in CPU operations.
a
Give the following code, what option is missing? proc format; value times (?) '00:00't-'04:59't = 'Red Eye' '05:00't-'11:59't = 'Morning' '12:00't-'17:59't = 'Afternoon' '18:00't-'23:59't = 'Evening' '00:00't-'11:59't = 'AM' '12:00't-'23:59't = 'PM'; run; a. MULTILABEL b. MULTIRANGE c. MLF d. MULTIFORMAT
b
Given the following OPTIONS statement, in what order will SAS search to find a user-defined format? options fmtsearch=(work abs.newfmt sasuser); a. Work.Formats -> Abc.Newfmt -> Sasuser.formats -> Library.Formats b. Work.Formats -> Library.Formats -> Abc.Newfmt -> Sasuser.Formats c. Work.Formats -> Abc.Newfmt -> Sasuser.Format d. the default search order
c
Given the following PROC FORMAT step, how is the value 6.1 displayed when the SKICOND format is applied? proc format; value skicond 0-3 = 'Poor' 3<-6='Fair' 6<-9='Good' 9<-high='Excellent'; run; a. 6.1 b. Fair c. Good d. .
c
Given the following PROC FORMAT step, how is the value 70 displayed when the AGEGRP. format is applied? proc format; picture agegrp 1-<13='00 Youth' 13-<20='00 Teen' 20-<70='00 Adult' 70-high='000 Senior'; run; a. 000 Senior b. 70 Adult c. 70 Senior d. 070 Senior
a
If you store a macro definition in a SAS catalog SOURCE entry a. the macro definition can be submitted for compilation by using the FILENAME and %INCLUDE statements. b. you can use the PROC CATALOG statement to compile the macro. c. the SOURCE entry will be deleted at the end of the session. d. you do not need to compile the macro before you invoke it in a program.
d
If you use a mixed parameter list in your macro program definition, which of the following is false? a. You must list positional parameters before any keyword parameters. b. Values for both positional and keyword parameters are stored in a local symbol table. c. Default values for keyword parameters are the values that are assigned in the macro definition, whereas positional parameters have a default value of null. d. You can assign a null value to a keyword parameter in a call to the macro by omitting the parameter from the call.
d
If you use the Stored Compiled Macro Facility, a. the macro processor does not compile a macro every time it is used. b. the only compiled macros that the Stored Compiled Macro Facility can access are those that are stored in the Sasmacr catalog. c. you need to specify the MSTORED and SASMSTORE= system options. d. all of the above
c
In order for PROC SQL to perform an inner join, a. the tables being joined must contain the same number of columns. b. the tables must be sorted before they are joined. c. the columns that are specified in a join condition in the WHERE clause must have the same data type. d. the columns that are specified in a join condition in the WHERE clause must have the same name.
a
In which of the following situations is sequential access likely to be more efficient than direct access for WHERE processing? a. The subset contains over 75% of the observations in the data set. b. The WHERE expression specifies both key variables in a single composite index. c. The data is sorted on the key variable. d. The data set is very large.
d
In which of the following situations would you use SYMGET rather than a macro variable reference (&macvar)? a. to create a DATA step variable from a macro variable value during the execution of the DATA step b. to include a macro variable reference in a PROC SQL view d. to access the value of a macro variable during the execution of an SCL program d. all of the above
c
Macro character functions a. can be used to manipulate character strings in macro variable values. b. have the same basic syntax as the corresponding DATA step functions and yield similar results. c. all of the above d. none of the above
a
PROC SQL options are specified in a. the PROC SQL statement. b. an OPTIONS statement. c. a SELECT statement. d. the OPTIONS procedure.
d
PROC SQL views can access data from a. a SAS data file. b. another PROC SQL view. c. a relational database table. d. all of the above
b
Select the program that correctly creates a new data set named Sasuser.Summary that contains one observation with summary data created from the Salary variable of the Sasuser.Empdata data set. a. proc sum data=sasuser.empdata noprint; output out=sasuser.summary sum=Salarysum; run; b. proc means data=sasuser.empdata noprint; var salary; output out=sasuser.summary sum=Salarsum; run; c. proc sum data=sasuser.empdata noprint; var salary; output out=sasuser.summary sum=Salarsum; run; d. proc means data=sasuser.empdata noprint; output=sasuser.summary sum=Salarsum; run;
b
Suppose that the Sasuser.Revenue data set has a simple index named FlightID. For which of the following programs will the index be used? a. proc print data=sasuser.revenue; where flightid ne 'IA11200'; run; b. data someflights; set sasuser.revenue; where flightid > 'IA11200'; run; c. data someflights; set sasuser.revenue; if flightid > 'IA11200'; run; d. proc print data=sasuser.revenue; where origin='RDU' or flightid='IA03400'; run;
b
Suppose you want to merge Dataset1, Dataset2, and Dataset3. Also suppose that Dataset1 and Dataset2 have the common variable Startdate, Dataset2 and Dataset3 have the common variable Instructor, and that these data sets have no other common variables. How can you use a DATA step to merge these three data sets into one new data set? a. You use a MERGE statement in one DATA set to merge Dataset1, Dataset2, and Dataset3 by Startdate and Instructor. b. You sort Dataset1 and Dataset2 by Startdate and merge them into a temporary data set in a DATA step. Then you sort the temporary data set and Dataset3 by Instructor and merge them into a new data set in a DATA step. c. You can merge these data sets only with a PROC SQL step. d. You cannot merge these three data sets at all because they do not have a common variable.
d
The %INCLUDE statement a. can be used to insert the contents of an external file into a program. b. will cause a macro definition that is stored in an external file to be compiled when the contents of that file are inserted into a program and submitted. c. can be specified with the SOURCE2 option in order to write the contents of the external file that is inserted into a program to the SAS log. d. all of the above.
d
The SYMPUT routine cannot a. be used to assign a data set variable as a value to a macro variable. b. create a series of macro variables in one DATA step. c. automatically convert a numeric value to a character value when used to assign a value to a macro variable in a DATA step. d. be used to assign a numeric value to a macro variable in a SCL program.
c
The automatic variable _IORC_ is created when you use the MODIFY statement with a BY statement of the KEY= option. How can you use the value of _IORC_? a. to determine whether the index specified on the KEY= option is a valid index b. to determine the number of observations that were updated in the master data set c. to determine the status of the I/O operation d. to determine the number of observations that could not be updated in the master data set
b
The four types of tokens that SAS recognizes are a. expressions, literals, names, and special characters. b. literals, names, numbers, and special characters. c. expressions, names, numbers, and special characters. d. expressions, literals, numbers, and special characters.
d
The keyword ALL cannot be used with which of the following set operators? a. EXCEPT b. INTERSECT c. UNION d. OUTER UNION
a
The total number of bytes occupied by a data set equals...? a. the page size multiplied by the number of pages. b. the page size multiplied by the number of observations. c. the sum of the page size and the number of pages. d. the number of pages multiplied by the number of variables.
d
The variable that is created by the POINT= option is assigned a value a. automatically during compilation of the DATA step. b. automatically during execution of the DATA step. c. during compilation of the DATA step, by program statements. d. during execution of the DATA step, by program statements.
d
To create an index on an existing data set, you use a. PROC DATASETS b. PROC SQL c. the DATA step with the INDEX= option, to rebuild the data set. d. any of the above
a
To process a default DATA step match-merge, SAS fist reads the descriptor portion of each data set and sets up the PDV and the descriptor portion of the new data set. Which of the following accurate describes the rest of this process? a. Next, SAS sequentially match-merges observations and writes the new observation to the PDV, then to the new data set. When the by value changes in all the input data sets, the PDV is initialized to missing. Missing values for variables, as well as missing values that result from unmatched observations, are written to the new data set. b. Next, SAS sequentially match-merges observations and writes the new observation to the PDV, then to the new data set. After each DATA step iteration, the PDV is initialized to missing. Missing values for variables, as well as missing values that result from unmatched observations, are omitted from the new dataset. c. Next, SAS creates a Cartesian product of all possible combinations of observations and writes them to the PDV, then to the new data set. Then SAS goes through the new data set and eliminates all observations that do not have matching values of the BY variable. d. Next, SAS creates a Cartesian produce of all possible combinations of observations and writes them to the PDV, then to the new data set. The new data set is then ordered by values of the BY variable.
b
To view a list of the indexes that are associated with a data set, you use a. PROC COPY or the COPY statement in PROC DATASETS. b. PROC CONTENTS or the CONTENTS statement in PROC DATASETS. c. the MSGLEVEL= system option and a PROC PRINT step. d. any of the above
b
Which of the following programs drops (deletes) a view? a. proc sql; delete sasuser.newview; b. proc sql; drop view sasuser.newview; c. proc sqpl; erase view sasuser.newview; d. proc sql; remove newview from sasuser;
d
Using an index is not likely to optimize a PROC SQL query in which of the following situations? a. The query contains an IN subquery that references the key column. b. The key column is specified in a WHERE clause expression that contains a comparison operator, the TRIM or SUBSTR function, the CONTAINS operator, or the LIKE operator. c. The query is an equijoin, and all the columns in the join expression are indexed in one of the tables being joined. d. The key column is specified only in a SELECT clause.
c
What are the resulting values for the macro variables that are defined here? %let month1 = June; %let month2 = July; %let period1 = &month1&month2; %let period2 = May&month1; %let period3 = &month2.Aug; a. month1 Junemonth2 Julyperiod1 June Julyperiod2 May Juneperiod3 July Aug b. month1 Junemonth2 Julyperiod1 JuneJulyperiod2 MayJuneperiod3 July.Aug c. month1 Junemonth2 Julyperiod1 JuneJulyperiod2 MayJuneperiod2 JulyAug d. month1 Junemonth2 Julyperiod1 junejulyperiod2 Mayjuneperiod3 julyaug
c
What happens if the workspace that is required for completing a sort is less than or equal to the value that is specified in the SORTSIZE= system option or procedure option? a. CPU time is increased. b. I/O is increased. c. The entire sort can take place in memory. d. A temporary utility file is created in the Work directory or in a mainframe temporary area.
c
What happens if you use a GROUP BY clause in a PROC SQL step without a summary function? a. The step does not execute. b. The first numeric column is summed by default. c. The GROUP BY clause is changed to an ORDER BY clause. d. The step executes but does not group or sort data.
a
What happens when SAS processes the last data record in an input file? a. The END= variable is set to 1. b. The END= variable is set to 0. c. The END= variable is set to the number of records in the input file. d. The END= variable is written to the data set.
a
What is the purpose of specifying the data set option IDXWHERE=YES? a. It forces SAS to use the best available index to process the WHERE expression. b. It creates an index from the expression in the WHERE clause. c. It writes messages about index usage to the SAS log. d. It stops SAS from using any index.
d
What option is used with PROC FORMAT to document the formats in a particular format catalog? a. FMTSEARCH b. FMTERR c. CATALOG d. FMTLIB
c
What statement is false with respect to a set operation that uses the EXCEPT, UNION or INTERSECT set operator without a keyword? a. Column names in the results set are determined by the first table. b. To be overlaid columns must be of the same data type. c. To be overlaid columns must have the same name. d. By default, only unique rows are displayed in the result set.
d
What value will these statements assign to the macro variable reptitle: %let area = "Southeast"; %let reptitle = * Sales Report for &area Area * a. Sales Report for Southeast Area b. Sales Report for "Southeast" Area c. *Sales Report for "Southeast" Area* d. * Sales Report for "Southeast" Area *
b
What will the following PROC CATALOG step do? proc catalog cat=mylib.sasmacr; contents; quit; a. Copy the contents of the Sasmacr catalog to a temporary data set. b. List the contents of the Sasmacr catalog as output. c. Copy the contents of the output window to the Sasmacr catalog. d. none of the above
a
When is it more advantageous to create a temporary SAS data set rather than a permanent SAS data set? a. When the external file on which the data set is based might change between SAS sessions. b. When the external file on which the data set is based does not change between SAS sessions. c. When the data set is needed for more than one SAS session. d. When you are converting raw numeric values to SAS data values.
b
When the NOFMTERR system option is in effect, what happens when SAS encounters a format it cannot locate? a. Creates the format in the default Work.Formats directory and continues processing. b. Substitutes the $w. or w. format and continues processing. c. Stops processing and writes an error message to the log. d. Skips processing at that step and continues with the next step and writes a note to the log.
d
When you are working with PROC SQL views, it is best to a. avoid using an ORDER BY clause in a view. b. avoid creating views that are based on tables whose structure might change. c. specify a one-level name in the FROM clause if the view resides in the same SAS data library as the contributing table(s). d. all of the above
c
When you compare the technique of using multiple DATASETS procedures to using a single DATASETS procedure to modify the descriptor portion of a data set, which is true? a. A one-step DATASETS procedure results in an increase in I/O operations. b. Multiple DATASETS procedures result in a decrease in I/O operations. c. A one-step DATASETS procedure results in a decrease in CPU usage. d. Multiple DATASETS procedures result in a decrease in CPU usage.
d
When you submit a call to a compiled macro, what happens? a. First, the macro processor checks all macro programming statements in the macro for syntax errors. Then the macro processor executes all statements in the macro. b. The macro processor executes compiled macro programming statements. Then any SAS programming language statements are executed by the macro processor. c. First, all compiled macro programming statements are executed by the macro processor. After all macro statements have been processed, any SAS language statements are passed back to the input stack in order to be passed to the compiler and then executed. d. The macro processor executes compiled macro statements. If any SAS language statements are encountered, they are passed back to the input stack. The macro processor pauses while those statements are passed to the compiler and then executed. Then the macro processor continues to repeat these steps until it reaches the %MEND statement.
a
When you submit the following code, what happens? %macro prtlast; proc print data=&syslast (obs=5); title "listing of &syslast data set"; run; %mend a. A session-compiled macro named Prtlast is stored in Work.Sasmacr. b. a macro named Prtlast is stored in the autocall library c. The Prtlast macro is stored as a stored compiled macro. d. The Prtlast macro is stored as a SOURCE entry in a permanent SAS catalog.
d
When you use an %IF-%THEN statement in you macro program, a. you must place %DO and %END statements around code that describes the conditional action, if that code contains multiple statements. b. the %ELSE statement is optional. c. you cannot refer to DATA step variables in the logical expression of the %IF statement. d. all of the above
c
Which DATA step uses the transaction data set Records.Overnight to update the master data set Records.Snowfall by accumAmt? a. data records.snowfall; modify records.snowfall records.overnight key=accumAmt; run; b. data records.snowfall; modify records.overnight records.snowfall; by accumAmt; run; c. data records.snowfall; modify records.snowfall records.overnight; by accumAmt; run; d. data records.snowfall modify records.snowfall records.overnight; update accumAmt; run;
d
Which PROC DATASETS step creates an integrity constraint named val_age on the data set Survey to ensure that values of the variable age are greater than or equal to 18? a. proc datasets nolist; modify age; ic create val_age=check(where(age>=18)); quit; b. proc datasets nolist; modify Survey; ic create val_age=check(age>=18); quit; c. proc datasets nolist; modify survey integrity constraints val_age=check(where=(age>=18)); quit; d. proc datasets nolist; modify survey; ic create val_age=check(where=(age>=18)); quit;
c
Which PROC FORMAT option is used to create a SAS data set from a format? a. CNTLIN= b. LIB= c. CNTLOUT= d. FMTLIB
d
Which PROC SQL query produces the same output as the query shown here? proc sql; select a.*, duration from groupa as a, groupb as b where a.obs=b.obs; Note: Assume that the table Groupa contains the columns Obs and Med. Groupb contains the columns Obs and Duration. a. proc sql; select a.obs label='Obs', med b.obs label='Obs', duration from groupa as a, groupb as b where a.obs=b.obs; b. proc sql; select coalesce(a.obs,b.obs) label='Obs', med, duration from groupa as a full join groupb as b on a.obs=b.obs; c. proc sql; select a.*, duration from groupa as a left join groupb as b where a.obs=b.obs; d. proc sql; select a.*, duration from groupa as a inner join groupb as b on a.obs=b.obs;
d
Which PROC SQL query will remove duplicate values of MemberType from the query output, so that only the unique values are listed? a. proc sql nodup; select membertype from sasuser.frequentflyers; b. proc sql; select distinct(membertype) as MemberType from sasuser.frequentflyers; c. proc sql; select unique membertype from sasuser.frequentflyers group by membertype; d. proc sql; select distinct membertype from sasuser.frequentflyers;
a
Which PROC SQL step combines tables but does not overlay any columns? a. proc sql; select * from groupa outer union select * grom groupb b. proc sql; select * from groupa as a outer union corr select * from groupb as b; c. proc sql; select coalesce(a.obs, b.obs) label='Obs', med, duration from groupa as a full join groupb as b on a.obs=b.obs; d. proc sql; select * from groupa as a intersect select * from groupb as b;
a
Which PROC SQL step correctly references the view Data.Empview? a. proc sql; select * from data.empview; b. proc sql; select * from view data.empview; c. proc sql; select view * from data.empview d. proc sql; select * from data where view='empview';
c
Which PROC SQL step creates a view that queries the table Sasuser.Payrollmaster? a. proc sql; insert into sasuser.newview select * from sasuser.payrollmaster; b. proc sql; create sasuser.newview as select * from sasuser.payrollmaster; c. proc sql; create view sasuser.newview as select * from sasuser.payrollmaster; d. proc sql; select * from sasuser.payrollmaster into view sasuser.newview;
a
Which PROC SQL step will generate the same results as the following DATA step? data allstudents; set prog1 prog2; by lname; proc print noobs; run; a. proc sql; select fname, lname from prog1 outer union corr selet fname, lname from prog2 order by lname; b. proc sql; select fname, lname from prog1 union select fname,lname from prog2 order by lname; c. proc sql; select fname, lname from prog2 outer union select fname, lname from prog1 order by lname; d. proc sql; select fname, lname from prog2 union corr select fname, lname from prog1 order by lname;
d
Which SAS system option is used to identify format catalogs to SAS? a. FMTERR b. FMTLIB c. NOFMTERR d. FMTSEARCH=
b
Which SORT procedure option compares all of the variable values for each observation to those for the previous observation that was written to the output data set? a. NODUPKEY b. NODUPRECS c. EQUALS d. NOEQUALS
c
Which clause below specifies that the two tables Produce and Hardware be queried? Both tables are located in a library to which the libref Sales has been assigned. a. select sales.produce sales.hardware b. from sales.produce sales.hardware c. from sales.produce, sales.hardware d. where sale.produce, sales.hardware
b
Which clause in the following program is incorrect? proc sql; select sex, mean(weight) as avgweight from company.employees company.health where employees.id=health.id group by sex; a. SELECT b. FROM c. WHERE d. GROUP BY
d
Which code creates an audit trail on the SAS data set Reports.Quarter1? a. proc datasets nolist; audit quarter1; initiate; quit; b. proc datasets lib=reports nolist; audit initiate reports.quarter1; quit; c. proc datasets lib=reports nolist; initiate audit quater1; quit; d. proc datasets lib=reports nolist; audit quarter1; initiate; quit;
a
Which code deletes all generations of the data set Sasuser.Amounts including the base data set? a. proc datasets lib=sasuser nolist; delete amounts (gennum=ALL); quit; b. proc datasets lib=sasuser nolist; delete amounts (gennum=HIST); quit; c. proc datasets lib=sasuser nolist; delete amounts (gennum=0); quit; d. proc datasets lib=sasuser nolist; delete amounts; quit;
a
Which code initiates generation data sets on the existing SAS data set Sasuser.Amounts and specifies that five historical versions are saved in addition to the base version? a. proc datasets lib=sasuser nolist; modify Amounts (genmax=6); quit; b. proc datasets lib=sasuser nolist; modify Amounts (genmax=5); quit; c. proc datasets lib=sasuser nolist; modify Amounts (gennum=6); quit; d. proc datasets lib=sasuser nolist; modify Amounts (gennum=5); quit;
b
Which keyword must you add to your index definition in the CREATE INDEX statement to ensure that not duplicate values of the key column can exist? a. KEY b. UNIQUE c. NODUPS d. NODUPKEY
b
Which of the clauses below correctly sorts rows by the values of the columns Price and SqFeet? a. order price, sqfeet b. order by price, sqfeet c. sort by price sqfeet d. sort price sqfeet
a
Which of the clauses in the PROC SQL program below is written incorrectly? proc sql; select style sqfeet bedrooms from choice.houses where sqfeet ge 800; a. SELECT b. FROM c. WHERE d. both a and c
d
Which of the following PROC SQL steps correctly embeds a LIBNAME statement with a view definition? a. proc sql; insert into sasuser.newview select \* from ariline.supervisors libname airline 'c:\mysql'; b. pro sql; create view sasuser.newview as from airline.supervisors embed libname airline 'c:\mysql'; c. proc sql; using airline 'c:\mysql'; insert into sasuser.newview select \* from airline.supervisors; d. proc sql; create view sasuser.newview as select * from airline.supervisors using libname airline 'c:\mysql';
b
Which of the following PROC SQL steps creates a new table by copying only the column structure (but not the rows) of an existing table? a. proc sql; create table work.newpayoll as select * from sasuser.payrollmaster; b. proc sql; create table work.newpayroll like sasuser.payrollmaster; c. proc sql; create table work.newpayroll copy sasuser.payrollmaster; d. proc sql; create table work.newpayroll describe sasuser.payrollmaster;
a
Which of the following PROC SQL steps creates a table that contains rows for the level-1 flight attendants only? a. proc sql; create table work.newpayroll as select * from sasuser.payrollmaster where jobcode='FA1'; b. proc sql; create work.newpayroll as select * from sasuser.payrollmaster where jobcode='FA1'; c. proc sql; create table work.newpayroll copy sasuser.payrollmaster where jobcode='FA1'; d. proc sql; create table work.newpayroll as sasuser.payrollmaster where jobcode='FA1';
d
Which of the following PROC SQL steps deletes rows for all frequent-flyer program members who traveled less than 10,000 miles? a. proc sql; delete rows from work.frequentflyers where milestraveled < 10000; b. proc sql; drop rows from work.frequentflyers where milestraveled < 10000; c. proc sql; drop table from work.frequentflyers where milestraveled < 10000; d. proc sql; delete from work.frequentflyers where milestraveled < 10000;
b
Which of the following PROC SQL steps displays information about the Dictionary table Dictionary.Titles? a. proc sql; describe dictionary.titles; b. proc sql; describe table dictionary.titles; c. proc sql describe table dictionary.titles; d. proc sql describe dictionary titles;
a
Which of the following PROC SQL steps displays the name (Memname), modification date, (Modate), number of variable (Nvar), and the number of observations (Nobs) for each table in the Sasuser library? a. proc sql; select memname, modate, nvar, nobs from dictionary.tables where libname='SASUSER'; b. proc sql; select memname, modate, nvar, nobs from dictionary.tables where libname='Sasuser'; c. proc sql; select memname, modate, nvar, nobs from 'SASUSER' where table=dictionary.tables; d. proc sql; select SASUSER from dictionary.tables where cols='memname, modate, nvar, nobs';
b
Which of the following PROC SQL steps enables you to see a description of the view definition? a. proc sql; select * from sasuser.payrollmasterv; b. proc sql; describe view sasuser.payrollmasterv; c. proc sql; list sasuser.payrollmasterv; d. proc sql; contents view=sasuser.payrollmasterv;
b
Which of the following PROC SQL steps gives bonuses (in points) to frequent-flyer program members as follows: -a 50% bonus for members who traveled less than 10,000 miles - a 100% bonus for members who traveled 10,000 miles or more? a. proc sql; update work.frequentflyers set pointsearned=pointsearned* case if milestraveled < 10000 then 1.5 if milestraveled >= 10000 then 2 else 1 end; b. proc sql; update work.frequenflyers set pointsearned=pointsearned* case when milestraveled < 10000 then 1.5 when milestraveled >= 10000 then 2 else 1 end; c. proc sql; update work.frequentflyers set pointsearned=pointsearned* case if milestraveled < 10000 then pointsearned*1.5 if milestraveled >= 10000 then pointsearned*2 else 1 end; d. proc sql; update work.frequentflyers set pointsearned=pointsearned* case if milestraveled < 10000 then pointsearned*1.5 if milestraveled >= 10000 then pointsearned*2 else pointsearned*1 end;
d
Which of the following can be placed onto the input stack? a. only whole steps. b. only whole steps or whole statements. c. only whole statements or pieces of text within a statement. d. whole steps, whole statements, or pieces of text within statements.
c
Which of the following correctly creates a data set named Flights from the Sasuser.Revenue data set, creates a composite index named Fromto that is based on the values of Origin and Dest, and prints informational messages about the index to the SAS log? a. options msglevel=i; data flights index=(Fromto=origin dest); set sasuser.revenue; run; b. options msglevel=n; data flights (index=(Fromto=origin dest)); set sasuser.revenue; run; c. options msglevel=i; datat flights (index=(Fromto=(origin dest))); set sasuser.revenue; run; d. options msglevel=n; data flights (index=Fromto); set sasuser.revenue; run;
c
Which of the following correctly creates a macro variable in a PROC SQL step? a. call symput(daily_fee, put(fee/days, dollar8.); b. %let daily_fee=put(fee/days, dollar8.) c. select fee/days format=dollar8. into:daily_fee from sasuser.all; d. select fee/days format=dollar8. into daily_fee from sasuser.all;
a
Which of the following correctly creates a macro variable named region and assigns it to a value that is based on the value of the data set variable Location? a. data new; set sasuser.all; if location='Boston' then do; call symput('region','East'); end; else do; call symput('region','West'); end; run; b. data new; set sasuser.all; if location='Boston' then do; %let region=East; end; else %let region=West; end; run; c. data new; set sasuer.all; if location='Boston' then do; call symput(region,"East"); end; else call symput(region,"West"); end; run; d. data new; set sasuser.all; if location='Boston" then do; symput(region,East); end; else symput(region,West); end; run;
b
Which of the following correctly creates a permanently stored compiled macro? a. libname macrolib 'c:\mylib'; option sasmstore; %macro prtlast; / store proc print data=&syslast (obs=5); title "Listing of &syslast data set"; run; %mend b. libname macrolib 'c:\mylib'; options mstored sasmstore=macrolib; %macro prtlast / store; proc print data=&syslast (obs=5); title "Listing of &syslast data set"; run; %mend c. libname macrolib 'c:\mylib'; option mstored sasmstor=macrolib; %macro prtlast; proc print data=&syslast (obs=5) title "Listing of &syslast data set"; run; % mend d. libname macrolib 'c:\mylib'; %macro prtlast / store; proc print data=&syslast (obs=5); title "Listing of &syslast data set"; run; %mend
a
Which of the following correctly creates a simple index named Origin on the Revenue data set? a. proc sql; create index origin on revenue(origin); quit; b. proc sql; modify revenue; index=origin; quit; c. proc sql data=revenue; create index origin; quit; d. proc sql; index=origin on revenue; quit;
c
Which of the following correctly produces a title in which the current date is left justified in order to remove extra blanks? a. title "Report for %sysfunc(left(%sysfunc(today(),worddate.)))"; b. title "Report for %sysfunc(left(today(),worddate.))"; c. title "Report for %sysfunc(left(%qsysfunc(today(), worddate.)))"; d. title "Report for %left(today(),worddate))";
c
Which of the following correctly references the macro named Printdsn as shown here: %macro printdsn(dsn,vars); %if &vars= %then % do; proc print data=&dsn; title "Full Lister of %upcase(&dsn) data set"; run; %end %else %do; proc print data=&dsn; var &vars; title "lister of %upcase(&dsn) data set"; run; %end; %mend; a. %printdsn(sasuser.courses, course_title days); b. %printdsn(dsn=sasuser.courses,vars=course_title days) c. %printdsn(sasuser.courses, course_title days) d.%printdsn(sasuser.courses, course_title, days)
a
Which of the following creates an empty table that contains the 2 columns FullName and Age? a. proc sql; create table work.names (FullName char(25), Age num); b. proc sql; create table work.names as (FullName char(25), Age num); c. proc sql; create work.names (FullName char(25), Age num); d. proc sql; create table work.names set (FullName char(25), Age num);
c
Which of the following displays the structure of a table in the SAS log? a. proc sql; describe as select * from sasuser.payrollmaster; b. proc sql; describe contents sasuser.payrollmaster; c. proc sql; describe table sasuser.payrollmaster; d. proc sql; describe * from sasuser.payrollmaster;
c
Which of the following examples correctly defines a macro named Print that includes parameters name vars and total? a. %macro print(vars,total); proc print data=classes; var vars; sum total; run; %mend print; b. %macro print('vars','total'); proc print data=classes; var &vars; sum &total; run; %mend print; c. %macro print(vars,total); proc print data=classes; var &vars; sum &total; run; %mend print; d. %macro print(vars,total); proc print data=classes; var :vars; sum :total; run; %mend print;
b
Which of the following examples correctly defines the macro program Hex? a. %macro hex(start=1, stop=10, incr=1); %local i; data _null_; %do i=&start to &stop by &incr; value=&i; put "Hexadecimal form of &i is " value hex6.; %end; run; %mend hex; b. %macro hex(start=1, stop=10, incr=1); %local i; data _null_; %do i=&start to &stop %by &incr; value=&i; put "Hexadecimal form of &i is " value hex6.; %end; run; %mend hex; c. %macro hex(start=1, stop=10, incr=1); %local i; data _null_; %do i=&start to &stop by &incr; value=&i; put "Hexadecimal form of &i is " value hex6.; run; %mend hex; d. %macro hex(start=1, stop=10, incr=1); %local i; data _null_; %do i=&start to &stop by &incr; value=&i; put "Hexadecimal form of &i is " value hex6.; %end run; %mend hex;
c
Which of the following expressions will generate a random integer between 1 and 50? a. ceil(ranuni(50)) b. ranuni(50) c. ceil(ranuni(0)*50) d. ceil(ranuni(0))*50
c
Which of the following is false regarding the IDXNAME= data set option? a. The specified index must exist. b. The specified index must be suitable by having at least its first or only column match a condition in the WHERE expression. c. The option allows you to create and name an index on the table. d. The option directs SAS to use an index that you specify.
c
Which of the following is false regarding the use of an index? a. Equijoins can be performed without internal sorts. b. Indexes provide fast access to a small subset of data. c. Indexes can be created for numeric columns only. d. Indexes can enforce uniqueness.
c
Which of the following is false? a. A %LET statement causes the macro processor to create a macro variable before the program is compiled. b. To create a macro variable that is based on data calculated by the DATA step, you use the SYMPUT function. c. Macro functions are always processed during the execution of the DATA step. d. Macro variable references in a DATA step are always resolved prior to DATA step execution.
b
Which of the following is false? a. A %MACRO statement must always be paired with a %MEND statement. b. A macro definition can include macro variable references, but it cannot include SAS language statements. c. Only macro language statements are checked for syntax errors when the macro is compiled. d. Compiled macros are stored in a temporary SAS catalog by default.
c
Which of the following is false? a. the SYMPUT routine can be used to create a macro variable during execution of the DATA step or during execution of an SCL program. b. 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. c. PROC SQL automatically converts a numeric value to any macro variable value that you attempt to compare to a numeric value. d. in an SCL program, the SYMPUT routine can be used to assign a numeric value to a macro variable.
c
Which of the following is false? a. A macro program is compiled when you submit the macro definition. b. A macro program is executed when you call it (%macro-name). c. A macro program is stored in a SAS catalog entry only after it is executed. d. A macro program is available for execution throughout the SAS session in which it is compiled.
b
Which of the following is not a type of integrity constraint? a. CHECK b. NULL c. UNIQUE d. PRIMARY KEY
c
Which of the following is not an advantage of BY-group processing with an index that is based on the BY variables? a. The data can be sequenced without using the SORT procedure. b. There is no need to re-sort a data set when observations are modified or added. c. It is is generally more efficient than reading a sorted data set sequentially. d. The data can be sequenced by different variables if multiple indexes are used.
c
Which of the following is not true about stored compiled macros? a. Because these stored macros are compiled, you should save and maintain the source for the macro definitions in a different location. b. The Store Compiled Macro Facility compiles and saves compiled macros in a permanent catalog, in a library that you specify. c. You do not need to specify any system options in order to use the Stored Compiled Macro Facility. d. You cannot move a stored compiled macro to another operating system.
a
Which of the following is not true? a. The autocall macro facility stores compiled SAS macros in a collection of external files called an autocall library. b. Autocall librarys can be concatenated together. c. One disadvantage of the autocall facility is that the first time you call an autocall macro in a SAS session, the macro processor must use system resources to compile it. d. The autocall facility can be used in conjunction withe the Stored Compiled Macro Facility.
a
Which of the following is true? a. When you add observations to a data set, the index(es) are automatically updated with additional value/identifier pairs. b. When you rename a variable that is used as the key variable in a simple index, you must re-create the index. c. When you delete a data set, the index file remains until you delete it as well. d. When you copy a data set with the COPY statement, you must also copy the index file in another step.
d
Which of the following options does not affect the appearance of HTML, PDF, or RTF output? a. NUMBER | NONUMBER b. DOUBLE | NODOUBLE c. FLOW | NOFLOW | FLOW=n | FLOW=nm d. b and c
b
Which of the following options restricts the number of rows that PROC SQL takes as input from any single source? a. OUTOBS= b. INOBS= c. OBS= d. none of the above
b
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? a. data _null_; set sasuser.courses; call symput(course_code, trim(course_title)); %let crsid=C005; procprint data=sasuser.schedule noobs label; where course_code="&crsid"; val location begin_date teacher; title1 "Schedule for &c005"; run; b. 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; c. 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; d. 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;
b
Which of the following programs correctly creates a systematic sample from a data set with an unknown number of observations and outputs these same observations to a data set named Sample? a. data sample; set sasuser.sale2000 points=thisone nobs=totnum; output; stop; run; b. data sample; do thisone=100 to totnum by 100; set sasuser.sale2000 point=thisone nobs=totnum; output; end; stop; run; c. data sample; do thisone=100 to 1000 by 100; set sasuser.sale2000 point=thisone; output; end; stop; run; d. data sample; do thisone=100 to totnum by 100; set sasuser.sale2000 point=thisone nobs=totnum; end; run;
d
Which of the following programs correctly creates a table with the results of a PROC SQL inner join matched on the values of empcode? a. proc sql; select newsals.emcode allemps.lastname newsals.salary contrib.amount from sasuser.allemps, sasuser.contrib, sasuser.newsals where empcode=allemps.emid and empcode=contrib.empid; quit; b. proc sql; create table usesql as select newsals.empcode allemps.lastname newsals.salsry contrib.amount from sasuser.allemps, sasuser.cotrib, sasuser.newsals quit; c. proc sql; create table usesql as; select newsals.empcode, allemps.lastname, newsals.salary, contrib.amount; from sasuser.allemps, sasuser.contrib, sasuser.newsals; where empcode=allemps.empid and empcode=contrib.empid; quit; d. proc sql; create table usesql as select newsals.empcode, allemps.lastname, newsals.salary, contrib.amount from sasuser.allemps, sasuser.contrib, sasuser.newsals where empcode=allemps.empid and empcode=contrib=empid; quit;
c
Which of the following programs correctly creates reduced-length numberic variables? a. data temp; infile file1; input x 4. y 3. z 2.; run; b. data temp; format x 4. y 3. z 2. ; infile file1; input x 4. y 3. z 2.; run; c. data temp; length x 4 y 3 z 2; infile file1; input x 4. y 3. z 2.; run; d. data temp; informat x 4. y 3. z 2.; infile file 1; input x 4. y 3. z 2.; run;
c
Which of the following programs correctly sets the appropriate system options and calls the macro Prtlast? Assume that Prtlast is stored in an autocall library as a text file and that it has not been compiled during the current SAS session. a. libname mylib 'c:\mylib'; filename macsrc 'mylib.macsrc'; options mautosource sasautos=(macsrc, sasautos); %prtlast b. libname mylib 'c:\mylib'; filename macsrc catalog 'mylib.macsrc'; %prtlast c. filename mylib 'c:\mylib'; options mautosource sasautos=(sasautos,mylib); %prtlast d. libname mylib 'c:\mylib'; option mautosource sasautos=mylib; %prtlast
d
Which of the following programs correctly uses an index to combine data from two input data sets? a. data work.profit; set sasuser.sale2000(keep=routid flightid date rev1st revbusiness revecon revcargo) key=flightdat; set sasuser.dnunder; Profit=sum(rev1st,revbusiness,revecon,revcargo,-expenses); run; b. data work.profit; set sasuser.dnunder; set sasuser.sale2000 (deep=routeid flightid date rev1st revbusiness revecon revcargo) key=flightdate; where routeid='0000103'; Profit=sum(rev1st,revbusiness,reecon,revcargo,-expenses); run; c. data work.profit; set sasuser.dnunder; set sasuser.sale2000 (keep=routeide flightid date rev1st revbusiness revecon revcargo); key=flightdate; Profit=sum(rev1st,revbusiness,revecon,revcargo,-expenses); run; d. data work.profit; set sasuser.dnunder; set sasuser.sale2000 (keep= routeid flightid date rev1st revbusiness revecon revcargo) key=flightdate; Profit=sum(rev1st, revbusiness, revecon, revcargo, -expenses); run;
b
Which of the following programs should you use to detect any loss of precision between the default-length numeric variables in Company.Regular and the reduced-length numeric variables in the data set Company.Reduced? a. proc contents data=company.regular; compare data=company.reduced; run; b. proc compare base=company.regular compare=company reduced; run; c. proc print data=company.regular; run; proc print data=company.reduced; run; d. proc datasets library=company; contents data=regular compare=reduced; run;
a
Which of the following statements about SAS data views is true? a. SAS data views use less disk space but more CPU resources than SAS data files. b. SAS data views can be created only in permanent SAS data libraries. c. SAS data views use less CPU resources but more disk space than SAS data files. d. SAS data views can be created only in temporary SAS data libraries.
c
Which of the following statements about audit trails is true? a. They create historical versions of data so that a copy of the data set is save each time the data is replaced. b. They record information about changes to observations in a data set each time the data set is replaced. c. They record information about changes to observation sin a data set each time the data is modified in place. d. The audit trail file has the same name as the SAS data file it is monitoring, but had #AUDIT at the end of the data set name.
b
Which of the following statements about compressed SAS data files is true? a. The descriptor portion is stored on whatever data set page has enough room for it. b. Deleted observation space can be reused. c. Compressed SAS data files have a smaller overhead than uncompressed SAS data files. d. In a compressed SAS data set, each observation must be the same size.
b
Which of the following statements about the _IORC_ variable is false? a. It is automatically created when you use either a SET statement with the KEY= option or the MODIFY statement with the KEY= option in a DATA step. b. A value of zero for _IORC_ means that the most recent SET statement with the KEY= option (or MODIFY statement with the KEY= option) did not execute successfully. c. A value of zero for _IORC_ means that the most recent SET statement with the KEY= option (or MODIFY statement with the KEY= option) executed successfully. d. You can use the _IORC_ variable to prevent nonmatching data from being included when you use an index to combine data from multiple data sets.
b
Which of the following statements about the resolution of macro variables references is false? a. Two ampersands resolve to one ampersand. b. If more than four consecutive ampersands precede a name token, the macro processor generates an error message. c. RE-scanning continues until there are no remaining macro triggers that the macro processor can resolve. d. The macro processor always re-scans a name token that is preceded by multiple ampersands or by multiple percent signs.
d
Which of the following statements about uncompressed SAS data files is true? a. The descriptor portion is stored on whatever page has enough room for it. b. New observations are always added in the first sufficient available space. c. Deleted observation space is tracked. d. New observations are always added at the end of the data set.
c
Which of the following statements associates the filref OnSale with the raw data files London.data, 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';
d
Which of the following statements correctly creates a DATA step variable named Price and assigns it to the value of the macro variable daily_fee during DATA step execution? a. price=&daily_fee; b. price=symget(daily_fee); c. price=symget(&daily_fee); d. price=symget("daily_fee");
d
Which of the following statements describes an advantage of using a PROC SQL view? a. Views often save space, because a view is usually quite small compared with the data that it accesses. b. Views prevent users from continually submitting queries to omit unwanted columns or rows. c. Views hide complex joins or queries from users. d. All of the above
c
Which of the following statements is false about using multiple SET statements in one DATA step? a. You can use multiple SET statements to combine observations from several SAS data sets. b. Processing stops when SAS encounters the end-of-file (EOF) marker on either data set (even if there is more data in the other data set). c. You can use multiple SET statements in one DATA step only if the data sets in each SET statement have a common variable. d. The variables in the PDV are not reinitialized when a second SET statement is executed.
a
Which of the following statements is false regarding a PROC SQL view? a. A view cannot be used in a join. b. A view accesses the most current underlying data. c. A view follows the same naming conventions as a table. d. A view can be used in SAS programs in place of an actual SAS data file.
b
Which of the following statements is false? a. A macro variable can be defined and referenced anywhere in a SAS program except within data lines. b. Macro variables are always user-defined, and their values remain constant until they are changed by the user. c. Macro variables are text strings that are independent of SAS data sets. d. The values of macro variables can be up to 65,534 characters long.
d
Which of the following statements is not true regarding a page? a. A page is the unit of data transfer between the engine and the operating environment. b. A page includes the number of bytes used by the descriptor portion, the data values, and the overhead. c. The size of a page is analogous to buffer size. d. The size of a page can be changed at any time.
c
Which of the following statements is true about techniques that are used for modifying data and attributes? a. You can use PROC DATASETS to modify both data values and variable attributes. b. You can use PROC DATASETS to modify only data values. c. You can use the DATA step to modify both data values and variable attributes. d. You can use the DATA step to modify only variable attributes.
a
Which of the following statements is true regarding a file that is opened with the SASFILE statement? a. The file is available to subsequent DATA and PROC steps or applications until a SASFILE CLOSE statement is executed or until the program ends. b. The file is available to subsequent DATA and PROC steps or applications until a SASFILE END statement is executed. c. The file is available for subsequent utility or output processing until the program ends. d. If the file increases in size during processing, the number of buffers remains the same.
b
Which of the following statements is true regarding the BUFNO= option? a. The BUFNO= option specifies the size of each buffer that is used for reading writing a SAS data set. b. The BUFNO= option can improve execution time by limiting the number of input/output operations that are required. c. Using the BUFNO= option results in permanent changes to the data set. d. Using the BUFNO= option to increase the number of buffers results in decreased memory consumption.
d
Which of the following statements is true regarding the STIMER option in PROC SQL? a. The STIMER option in PROC SQL writes timing information for each statement to the SAS log. b. The STIMER option in PROC SQL writes only cumulative timing information for the entire procedure to the SAS log. c. When using the STIMER option in PROC SQL, the SAS system option STIMER must also be in effect. d. a and c
c
Which of the following statements is true regarding the UNDO_POLICY=REQUIRED option? a. It must be used with the REQUIRED integrity constraint. b. It ignores the specified integrity constraints if any of the rows that you want to insert or update do not meet the constraint criteria. c. It restores your table to its original state if any of the rows that you try to insert or update do not meet the specified integrity constraints criteria. d. It allows rows that meet the specified integrity constraint criteria to be inserted or updated, but rejects rows that do not meet the integrity constraint criteria.
d
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
a
Which of the following statements is used to add new rows to a table? a. INSERT b. LOAD c. VALUES d. CREATE TABLE
d
Which of the following statements regarding the ALTER TABLE statement is false? a. It allows you to update column attributes. b. It allows you to add new columns in your table. c. It allows you to drop columns in your table. d. It allows you to change a character column to a numeric column.
a
Which of the following statements will generate an error message while trying to display the value of the macro variable month in the SAS log? a. options &month; b. %PUT &month; c. options symbolgen; d. %PUT the macro variable MONTH has the value &month.;
c
Which of the following statements will generate an error message while trying to display the value of the macro variable month in the SAS log? a. title "Total Sales for '&month' "; b. title "Total Sales for 'month' "; c. title "Total Sales for &month"; d. title Total Sales for "&month";
d
Which of the following techniques does not summarize data for specific combinations of class variables? a. the NWAY option in multiple PROC MEANS steps b. the TYPES statement in a PROC MEANS step c. the WHERE= option in a PROC MEANS step d. a basic PROC MEANS step
b
Which of the following variables must be in the data set that is specified on the CNTLIN= option? a. End b. FmtName c. Value d. Description
d
Which of the following will cause PROC SQL to list rows that have no data in the Address column? a. WHERE address is missing b. WHERE address not exists c. WHERE address is null d. both a and c
d
Which of the following will create a composite index for the table Sasuser.Flightdelays? (Sasuser.Flightdelays contains the following columns: Date, DestinationType, DayOfWeek, and Delay.) a. proc sql; create index destination on sasuser.flightdelays(flightnumber,destination); b. proc sql; create composite index places on sasuser.flightdelays (flightnumber, destination); c. proc sql; create index on flightnumber,destination from sasuser.flightdelays (places); d. proc sql; create index places on sasuser.flightdelays (flightnumber, destination);
c
Which of the following will create a macro variable named class in a local symbol table? a. data _null_; set sasuser.courses; %let class=course_title; run; b. data _null_; set sasuser.courses; call symput('class', course_title); run; c. %macro sample(dsn); %local class; %let class=course_title; data _null_; set &dsn; run; %mend d. %global class; %macro sample(dsn); %let class=course_title; data _null_; set &dsn; run; %mend;
d
Which of the following will create an index on the column EmpID for the table Sasuser.Staffmaster? a. proc sql; create simple index(empid) on sasuser.staffmaster; b. proc sql; create empid index on sasuser.staffmaster(empid); c. proc sql; create simple index on empid from sasuser.staffmaster; d. proc sql; create index empid on sasuser.staffmaster(empid);
c
Which of the following will drop (delete) an index from a table? a. proc sql; drop composite index flights from sasuser.marchflights; b. proc sql; delete index flights on sasuser.staffmaster(flightnumber,date); c. proc sql; drop index flights from sasuser.marchflights; d. proc sql; delete index on sasuser.marchflights(flightnumber,flightdate);
a
Which of the following will write a message to the SAS log that shows whether PROC SQL has used an index? a. options msglevel=i; proc sql; select * from sasuser.internationalflights where date between '01mar2000'd and '07mar2000'd; b. options index=yes proc sql; select * from sasuser.internationalflights where date between '01mar2000'd and '07mar2000'd; c. proc sql; select * (idxwhere=yes) from sasuser.internationalflights where date between '01mar2000'd and '07mar2000'd; d. proc sql; select * (msglevel=1) from sasuser.internationalflights where date between '01mar2000'd and '07mar2000'd;
c
Which option is used with the SORT procedure to store only the BY variables and the observation numbers in temporary files? a. NOTSORTED b. GROUPFORMAT c. TAGSORT d. SORTEDBY=
c
Which set of statements would you add to the PROC CATALOG code to copy the LEVELS. and $PICKS. formats from the sasuser.formats catalog to the work.formats catalog? proc catalog cat=sasuser.formats; ? ? run; a. copy out=sasuser.formats; select levels.format $picks.format; b. copy out=work.formats; select levels $picks; c. copy out work.formats; select levels.format picks.formatc; d. copy out=work.formats; select levels.format $picks.format;
b
You want to summarize data and group it by one variable. Which of the following tools could not be used? a. The DATA step with BY group processing. b. The DATA step without BY group processing. c. PROC SQL with a GROUP BY clause. d. PROC MEANS with a CLASS statement.
c
Which statement about data remerging is true? a. When PROC SQL remerges data, it combines data from two tables. b. By using data remerging, PROC SQL can avoid making two passes through the data. c. When PROC SQL remerges data, it displays a related message in the SAS log. d. PROC SQL does not attempt to remerge data unless a subquery is used.
a
Which statement about in-line views is false? a. Once defined, an in-line view can be referenced in any PROC SQL query in the current SAS session. b. An in-line view can be assigned a table alias but not a permanent name. c. In-line views can be combined with tables in PROC SQL joins and set operations. d. This PROC SQL query contains an in-line view that uses valid syntax: proc sql; select name, numvisits from (select name, sum(checkin) as numvisits from facility as f. members as m where area='POOL' and f.id=m.id group by name) where numvisits <= 10 order by 1;
a
Which statement about the following PROC SQL query is false? proc sql; validate select name label='Country', rate label='Literacy Rate' from world.literacy where 'Asia' = (select continent from world.continents where literacy.name = continents.country) order by 2; a. The query syntax is not valid. b. The outer query must pass values to the subquery before the subquery can return values to the outer query. c. PROC SQL will not execute this query when it is submitted. d. After the query is submitted, the SAS log will indicate whether the query has valid syntax.
d
Which statement about the use of table aliases is false? a. Table aliases must be used when referencing identical table names from different libraries. b. Table aliases can be referenced by using the keyword AS. c. Table aliases (or full table names) must be used when referencing a column name that is the same in two or more tables. d. Table aliases must be used when using summary functions.
b
Which statement about using the KEY= option in the MODIFY statement is true? a. SAS locates the variables to update using the index specified in the KEY= option and then automatically overlays nonmissing transaction values as it does when you use the MODIFY/BY statements. b. When you use the KEY= option, you must explicitly state the update that you want to make. SAS does not automatically overlay nonmissing transaction values. c. The KEY= option is used to specify a variable to match for updating observations. d. The index named in the KEY= option must be a simple index.
b
Which statement about using the MODIFY statement in DATA step is true? a. MODIFY creates a second copy of the data while variables in the data are being matched with a WHERE clause and then deletes the second copy. b. You cannot modify the descriptor portion of the data set using the MODIFY statement. c. You can use the MODIFY statement to change the name of a variable. d. If the system terminates abnormally while a DATA step that is using the WHERE statement is processing, SAS automatically saves a copy of the unaltered data set.
a
Which statement is false regarding the keyword CORRESPONDING? a. It cannot be used with the keyword ALL. b. It overlays columns by name, not by position. c. When used in EXCEPT, INTERSECT, and UNION set operations, it removes any columns not found in both tables. d. When used in OUTER UNION set operations it causes same-named columns to be overlaid.
d
Which statement is true regarding the use of the PROC SQL step to query data that is stored in two or more tables? a. When you join multiple tables, the tables must contain a common column. b. You must specify the table from which you want each column to be read. c. The tables that are being joined must be from the same type of data source. d. If two tables that are being joined contain a same-named column, then you must specify the table from which you want the column to be read.
b
Which statement opens the file Work.Quarter1, allocates enough buffers to hold the entire file in memory, and reads the data into memory? a. sasfile work.quarter1 open; b. sasfile work.quarter1 load; c. sasfile work.quarter1 bufno=max; d. sasfile work.quarter1 bufsize=max;
d
Which statement will create a macro variable named location that has the value storage? a. &let location = storage; b. let &location = storage; c. %let location = "storage"; d. %let location = storage;
c
Which type of integrity constraints would you place on the variable StoreID to ensure that there are no missing values and that there are no duplicate values? a. UNIQUE b. CHECK c. PRIMARY KEY d. NOT NULL
d
Why can using an index reduce the number of I/O operations that are required for accessing a small subset? a. Using an index requires larger input buffers, which can hold more pages. b. The index does not have to be loaded into an input buffer. c. The number of observations that SAS has to load into the program data vector (PDV) is decreased. d. The number of pages that SAS has to load is decreased.
d
Why would you want to store your macros in external files? a. You could easily share your macros with others. b. You could edit your macros with any text editor. c. Your macros would be available for use in later SAS sessions. d. all of the above
b
You are creating a PROC SQL query that will list all employees who have spent (or overspent) their allotted 120 hours of vacation for the current year. The hours that each employee are used are stored in the existing column Spent. Your query defines a new column, Balance, to calculate each employee's balance of vacation hours. Which query will produce the report that you want? a. proc sql; select name, spent, 120-spent as calculated Balance from Company.Absences where balance <= 0; b. proc sql; select name, spent, 120-spent as Balance from Company.Absences where calculated balance <= 0; c. proc sql; select name, spent, 120-spent as Balance from Company.Absences where balance <= 0; d. proc sql; select name, spent, 120-spent as calculated Balance from Company.Absences where calculated balance <= 0;
b
You are writing a PROC SQL query that will display that names of all library cardholders who work as volunteers for the library, and the number of books that each volunteer currently has checked out. You will use one or both of the following tables: -Library.Circulation list the name and contact information for all library cardholders, and the number of books that each cardholder currently has checked out. -Library.Volunteers lists the name and contact information for all library volunteers. Assume that the values of Name are unique in both tables. Which of the following PROC SQL queries will produce your report? a. proc sql; select name, checkedout from library.circulation where * in (select * from library.volunteers); b. proc sql; select name, checkedout from library.circulation where name in (select name from library.volunteers); c. proc sql; select name from library.volunteers where name, checkedout in (select name, checkedout from library.circulation); d. proc sql; select name, checkedout from library.circulation where name in (select name from library.volunteers;);
c
You can update the data underlying PROC SQL view using the INSERT, DELETE, and UPDATE statements under which of the following conditions: a. The view is joined or linked to another table. b. The view contains a subquery. c. The view contains a WHERE clause. d. all of the above
b
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.
b
You want to select a subset of observations in the data set Company.Products, and you have defined a simple index on the variable Rating. SAS cannot use the index to process which of the following WHERE statements? a. where rating is missing; b. where rating=int(rating); c. where rating between 3.5 and 7.5; d. where rating=5.5;
b
which of the following statements will show you all the indexes that are defined for a table? a. DESCRIBE INDEX b. DESCRIBE TABLE c. SELECT d. IDXNAME